]> granicus.if.org Git - postgis/commitdiff
Made AddGeometryColumn delete from geometry_column records which would be incompatibl...
authorSandro Santilli <strk@keybit.net>
Tue, 1 Jun 2004 16:30:10 +0000 (16:30 +0000)
committerSandro Santilli <strk@keybit.net>
Tue, 1 Jun 2004 16:30:10 +0000 (16:30 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@561 b70326c6-7e19-0410-871a-916f4a2858ee

postgis.sql.in

index 9aec0f3793ca88e1d073b0907e2e782833bb7cd3..968d2e7fdca928c326d8ba14bc715f245b0eb57e 100644 (file)
@@ -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)