From: Sandro Santilli Date: Tue, 3 Mar 2015 12:42:47 +0000 (+0000) Subject: Have postgis_typmod_dims return NULL for unconstrained dims (#3068) X-Git-Tag: 2.2.0rc1~626 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b6199cea1fec077144fca488bb4a71bbd470a52d;p=postgis Have postgis_typmod_dims return NULL for unconstrained dims (#3068) This is consistent with postgis_constraint_type() also returning NULL for unconstrained. git-svn-id: http://svn.osgeo.org/postgis/trunk@13298 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/postgis/gserialized_typmod.c b/postgis/gserialized_typmod.c index caa669df9..6d4d6970b 100644 --- a/postgis/gserialized_typmod.c +++ b/postgis/gserialized_typmod.c @@ -363,7 +363,7 @@ Datum postgis_typmod_dims(PG_FUNCTION_ARGS) int32 typmod = PG_GETARG_INT32(0); int32 dims = 2; if ( typmod < 0 ) - PG_RETURN_INT32(dims); + PG_RETURN_NULL(); /* unconstrained */ if ( TYPMOD_GET_Z(typmod) ) dims++; if ( TYPMOD_GET_M(typmod) ) diff --git a/postgis/postgis.sql.in b/postgis/postgis.sql.in index 825bc63b9..6d0a9e9ea 100644 --- a/postgis/postgis.sql.in +++ b/postgis/postgis.sql.in @@ -4973,9 +4973,9 @@ CREATE OR REPLACE VIEW geometry_columns AS n.nspname::varchar(256) AS f_table_schema, c.relname::varchar(256) AS f_table_name, a.attname::varchar(256) AS f_geometry_column, - COALESCE(NULLIF(postgis_typmod_dims(a.atttypmod),2), + COALESCE(postgis_typmod_dims(a.atttypmod), postgis_constraint_dims(n.nspname, c.relname, a.attname), - 2) AS coord_dimension, + 2) AS coord_dimension, -- should it be 0 instead ? COALESCE(NULLIF(postgis_typmod_srid(a.atttypmod),0), postgis_constraint_srid(n.nspname, c.relname, a.attname), 0) AS srid,