]> granicus.if.org Git - postgis/commitdiff
#661 Type info of geography columns incomplete - pg_dump output wrong
authorPaul Ramsey <pramsey@cleverelephant.ca>
Wed, 25 May 2011 18:42:16 +0000 (18:42 +0000)
committerPaul Ramsey <pramsey@cleverelephant.ca>
Wed, 25 May 2011 18:42:16 +0000 (18:42 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@7248 b70326c6-7e19-0410-871a-916f4a2858ee

postgis/geography_inout.c

index 394a650571382e57999a2824c375209773041633..865a6cbddd437b07373fb8b2466a2b1a483eb129 100644 (file)
@@ -418,7 +418,7 @@ Datum geography_typmod_out(PG_FUNCTION_ARGS)
        POSTGIS_DEBUGF(3, "Got typmod(srid = %d, type = %d, hasz = %d, hasm = %d)", srid, type, hasz, hasm);
 
        /* No SRID or type or dimensionality? Then no typmod at all. Return empty string. */
-       if ( ! srid && ! type && ! hasz && ! hasz )
+       if ( ! ( srid || type || hasz || hasz ) )
        {
                *str = '\0';
                PG_RETURN_CSTRING(str);
@@ -430,10 +430,8 @@ Datum geography_typmod_out(PG_FUNCTION_ARGS)
        /* Has type? */
        if ( type )
                str += sprintf(str, "%s", lwtype_name(type));
-
-       /* Need dummy type to append Z/M to? */
-       if ( !type & (hasz || hasz) )
-               str += sprintf(str, "Geometry");
+  else if ( (!type) &&  ( srid || hasz || hasm ) )
+    str += sprintf(str, "Geometry");
 
        /* Has Z? */
        if ( hasz )
@@ -444,7 +442,7 @@ Datum geography_typmod_out(PG_FUNCTION_ARGS)
                str += sprintf(str, "%s", "M");
 
        /* Comma? */
-       if ( srid && ( type || hasz || hasm ) )
+       if ( srid )
                str += sprintf(str, ",");
 
        /* Has SRID? */