From: Regina Obe Date: Sun, 3 Jul 2011 00:59:28 +0000 (+0000) Subject: #1098 fix UpdateGeometrySRID X-Git-Tag: 2.0.0alpha1~1284 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f4dd4e05cf1056fa09aecb4872ce142c471d1a44;p=postgis #1098 fix UpdateGeometrySRID git-svn-id: http://svn.osgeo.org/postgis/trunk@7558 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/postgis/postgis.sql.in.c b/postgis/postgis.sql.in.c index a65d7bffb..7c946c745 100644 --- a/postgis/postgis.sql.in.c +++ b/postgis/postgis.sql.in.c @@ -2242,8 +2242,8 @@ BEGIN RETURN false; END IF; - IF postgis_constaint_srid(schema_name, table_name, column_name) > 0 THEN - -- srid was enforced with constraints before, keep it that way + IF postgis_constraint_srid(schema_name, table_name, column_name) IS NOT NULL THEN + -- srid was enforced with constraints before, keep it that way. -- Make up constraint name cname = 'enforce_srid_' || column_name; @@ -2270,7 +2270,7 @@ BEGIN -- We are using postgis_type_name to lookup the new name -- (in case Paul changes his mind and flips geometry_columns to return old upper case name) EXECUTE 'ALTER TABLE ' || quote_ident(real_schema) || '.' || quote_ident(table_name) || - ' ALTER COLUMN ' || quote_ident(column_name) || ' TYPE geometry(' || postgis_type_name(myrec.type, myrec.coord_dimension, true) || ', ' || new_srid::text || ');' ; + ' 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 || ');' ; END IF; RETURN real_schema || '.' || table_name || '.' || column_name ||' SRID changed to ' || new_srid::text;