]> granicus.if.org Git - postgis/commitdiff
Have postgis_typmod_dims return NULL for unconstrained dims (#3068)
authorSandro Santilli <strk@keybit.net>
Tue, 3 Mar 2015 12:42:47 +0000 (12:42 +0000)
committerSandro Santilli <strk@keybit.net>
Tue, 3 Mar 2015 12:42:47 +0000 (12:42 +0000)
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

postgis/gserialized_typmod.c
postgis/postgis.sql.in

index caa669df9a54a5a2f4935c4f98a03845c3594b4c..6d4d6970b07c342c8a82874580252eac612ef326 100644 (file)
@@ -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) )
index 825bc63b981eefe74ffba564031f74cb3b4fe491..6d0a9e9eac5a8e4f499d681e5dca3eb11babb72d 100644 (file)
@@ -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,