]> granicus.if.org Git - postgis/commitdiff
Fixed probe_geometry_columns so to work on spatial tables with multiple
authorSandro Santilli <strk@keybit.net>
Tue, 8 Feb 2005 07:37:42 +0000 (07:37 +0000)
committerSandro Santilli <strk@keybit.net>
Tue, 8 Feb 2005 07:37:42 +0000 (07:37 +0000)
geometry columns.

git-svn-id: http://svn.osgeo.org/postgis/trunk@1378 b70326c6-7e19-0410-871a-916f4a2858ee

lwgeom/lwpostgis.sql.in

index b66b4a3ad6da2fcb22ee65e968f1f4fd990a543d..21e01efd422370e3e7ded9125b21151502b87cf9 100644 (file)
@@ -2067,15 +2067,16 @@ BEGIN
                 AND c.oid = a.attrelid
                 AND c.relnamespace = n.oid
                 AND f_geometry_column::name = a.attname
+
                 AND sridcheck.conrelid = c.oid
-                --AND sridcheck.conname = ''$1''
                AND sridcheck.consrc LIKE ''(srid(% = %)''
+                AND sridcheck.consrc ~ textcat('' = '', srid::text)
+
                 AND typecheck.conrelid = c.oid
-                --AND typecheck.conname = ''$2''
                AND typecheck.consrc LIKE
        ''((geometrytype(%) = ''''%''''::text) OR (% IS NULL))''
-                AND sridcheck.consrc ~ textcat('' = '', srid::text)
                 AND typecheck.consrc ~ textcat('' = '''''', type::text)
+
                 AND NOT EXISTS (
                         SELECT oid FROM geometry_columns gc
                         WHERE c.relname::varchar = gc.f_table_name
@@ -2177,12 +2178,10 @@ BEGIN
                AND typecheck.connamespace = n.oid
 #endif
                AND sridcheck.conrelid = c.oid
-               --AND sridcheck.conname = ''$1''
-               AND sridcheck.consrc LIKE ''(srid(% = %)''
+               AND sridcheck.consrc LIKE ''(srid(''||a.attname||'') = %)''
                AND typecheck.conrelid = c.oid
-               --AND typecheck.conname = ''$2'';
                AND typecheck.consrc LIKE
-       ''((geometrytype(%) = ''''%''''::text) OR (% IS NULL))''
+       ''((geometrytype(''||a.attname||'') = ''''%''''::text) OR (% IS NULL))''
                ;
 
        INSERT INTO geometry_columns SELECT
@@ -2221,12 +2220,10 @@ BEGIN
                AND typecheck.connamespace = n.oid
 #endif
                AND sridcheck.conrelid = c.oid
-               --AND sridcheck.conname = ''$1''
-               AND sridcheck.consrc LIKE ''(srid(% = %)''
+               AND sridcheck.consrc LIKE ''(srid(''||a.attname||'') = %)''
                AND typecheck.conrelid = c.oid
-               --AND typecheck.conname = ''$2''
                AND typecheck.consrc LIKE
-       ''((geometrytype(%) = ''''%''''::text) OR (% IS NULL))''
+       ''((geometrytype(''||a.attname||'') = ''''%''''::text) OR (% IS NULL))''
 
                 AND NOT EXISTS (
                         SELECT oid FROM geometry_columns gc