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
-- 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