]> granicus.if.org Git - postgis/commitdiff
#1098 fix UpdateGeometrySRID
authorRegina Obe <lr@pcorp.us>
Sun, 3 Jul 2011 00:59:28 +0000 (00:59 +0000)
committerRegina Obe <lr@pcorp.us>
Sun, 3 Jul 2011 00:59:28 +0000 (00:59 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@7558 b70326c6-7e19-0410-871a-916f4a2858ee

postgis/postgis.sql.in.c

index a65d7bffb1554cc4eae3460d4507fb45d41fb492..7c946c74568ca5041e321a02345ce4e36683cd6d 100644 (file)
@@ -2242,8 +2242,8 @@ BEGIN
                RETURN false;\r
        END IF;\r
 \r
-       IF postgis_constaint_srid(schema_name, table_name, column_name) > 0 THEN \r
-       -- srid was enforced with constraints before, keep it that way\r
+       IF postgis_constraint_srid(schema_name, table_name, column_name) IS NOT NULL THEN \r
+       -- srid was enforced with constraints before, keep it that way.\r
         -- Make up constraint name\r
         cname = 'enforce_srid_'  || column_name;\r
     \r
@@ -2270,7 +2270,7 @@ BEGIN
         -- We are using postgis_type_name to lookup the new name \r
         -- (in case Paul changes his mind and flips geometry_columns to return old upper case name) \r
         EXECUTE 'ALTER TABLE ' || quote_ident(real_schema) || '.' || quote_ident(table_name) || \r
-            ' ALTER COLUMN ' || quote_ident(column_name) || ' TYPE  geometry(' || postgis_type_name(myrec.type, myrec.coord_dimension, true) || ', ' || new_srid::text || ');' ;\r
+        ' ALTER COLUMN ' || quote_ident(column_name) || ' TYPE  geometry(' || postgis_type_name(myrec.type, myrec.coord_dimension, true) || ', ' || new_srid::text || ') USING ST_SetSRID(' || quote_ident(column_name) || ',' || new_srid::text || ');' ;\r
     END IF;\r
 \r
        RETURN real_schema || '.' || table_name || '.' || column_name ||' SRID changed to ' || new_srid::text;\r