END;
' LANGUAGE 'plpgsql' WITH (isstrict);
+-----------------------------------------------------------------------
+-- DROPGEOMETRYTABLE
+-- <catalogue>, <schema>, <table>
+-----------------------------------------------------------------------
+--
+-- Drop a table and all its references in geometry_columns
+--
+-----------------------------------------------------------------------
+CREATEFUNCTION DropGeometryTable(varchar, varchar,varchar)
+ RETURNS text
+ AS
+'
+DECLARE
+ catalog_name alias for $1;
+ schema_name alias for $2;
+ table_name alias for $3;
+ real_schema name;
+
+BEGIN
+
+#if USE_VERSION >= 73
+ IF ( schema_name = '''' ) THEN
+ SELECT current_schema() into real_schema;
+ ELSE
+ real_schema = schema_name;
+ END IF;
+#endif // USE_VERSION >= 73
+
+ -- Remove refs from geometry_columns table
+ EXECUTE ''DELETE FROM geometry_columns WHERE '' ||
+#if USE_VERSION >= 73
+ ''f_table_schema = '' || quote_literal(real_schema) ||
+ '' AND '' ||
+#endif
+ '' f_table_name = '' || quote_literal(table_name);
+
+ -- Remove table
+ EXECUTE ''DROP TABLE ''
+#if USE_VERSION >= 73
+ || quote_ident(real_schema) || ''.'' ||
+#endif
+ quote_ident(table_name);
+
+ RETURN
+#if USE_VERSION >= 73
+ real_schema || ''.'' ||
+#endif
+ table_name ||'' dropped.'';
+
+END;
+'
+LANGUAGE 'plpgsql' WITH (isstrict);
+
+-----------------------------------------------------------------------
+-- DROPGEOMETRYTABLE
+-- <schema>, <table>
+-----------------------------------------------------------------------
+--
+-- Drop a table and all its references in geometry_columns
+--
+-----------------------------------------------------------------------
+CREATEFUNCTION DropGeometryTable(varchar,varchar) RETURNS text AS
+'SELECT DropGeometryTable('''',$1,$2)'
+LANGUAGE 'sql' WITH (isstrict);
+
+-----------------------------------------------------------------------
+-- DROPGEOMETRYTABLE
+-- <table>
+-----------------------------------------------------------------------
+--
+-- Drop a table and all its references in geometry_columns
+-- For PG>=73 use current_schema()
+--
+-----------------------------------------------------------------------
+CREATEFUNCTION DropGeometryTable(varchar) RETURNS text AS
+'SELECT DropGeometryTable('''','''',$1)'
+LANGUAGE 'sql' WITH (isstrict);
-----------------------------------------------------------------------
-- UPDATE_GEOMETRY_STATS()