From: Paul Ramsey Date: Wed, 25 May 2011 18:42:16 +0000 (+0000) Subject: #661 Type info of geography columns incomplete - pg_dump output wrong X-Git-Tag: 2.0.0alpha1~1566 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2efc7b2064d1a5291eab5c27335252f3c0cc939c;p=postgis #661 Type info of geography columns incomplete - pg_dump output wrong git-svn-id: http://svn.osgeo.org/postgis/trunk@7248 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/postgis/geography_inout.c b/postgis/geography_inout.c index 394a65057..865a6cbdd 100644 --- a/postgis/geography_inout.c +++ b/postgis/geography_inout.c @@ -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? */