From 88b5aa149bed4beee3050bbad46ff47ba87a9951 Mon Sep 17 00:00:00 2001 From: Sandro Santilli Date: Tue, 1 Jun 2004 16:30:10 +0000 Subject: [PATCH] Made AddGeometryColumn delete from geometry_column records which would be incompatible with the one being added git-svn-id: http://svn.osgeo.org/postgis/trunk@561 b70326c6-7e19-0410-871a-916f4a2858ee --- postgis.sql.in | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/postgis.sql.in b/postgis.sql.in index 9aec0f379..968d2e7fd 100644 --- a/postgis.sql.in +++ b/postgis.sql.in @@ -2735,6 +2735,8 @@ BEGIN #endif + -- Add geometry column + EXECUTE ''ALTER TABLE '' || #if USE_VERSION >= 73 quote_ident(real_schema) || ''.'' || quote_ident(table_name) @@ -2744,6 +2746,23 @@ BEGIN || '' ADD COLUMN '' || quote_ident(column_name) || '' geometry ''; + + -- Delete stale record in geometry_column (if any) + + EXECUTE ''DELETE FROM geometry_columns WHERE + f_table_catalog = '' || quote_literal('''') || + '' AND f_table_schema = '' || +#if USE_VERSION >= 73 + quote_literal(real_schema) || +#else + quote_literal('''') || +#endif + '' AND f_table_name = '' || quote_literal(table_name) || + '' AND f_geometry_column = '' || quote_literal(column_name); + + + -- Add record in geometry_column + EXECUTE ''INSERT INTO geometry_columns VALUES ('' || quote_literal('''') || '','' || #if USE_VERSION >= 73 @@ -2756,6 +2775,8 @@ BEGIN new_dim || '','' || new_srid || '','' || quote_literal(new_type) || '')''; + -- Add table checks + EXECUTE ''ALTER TABLE '' || #if USE_VERSION >= 73 quote_ident(real_schema) || ''.'' || quote_ident(table_name) -- 2.40.0