From 7cc0eff83f9afc5985dad29ba52ca71a4de73efa Mon Sep 17 00:00:00 2001 From: Sandro Santilli Date: Tue, 10 Jan 2012 18:12:27 +0000 Subject: [PATCH] Add rules on geometry_columns view to tolerate insert/update/delete Fixes OGR, see #1426. Raises no warning on operation (it should). This commit includes changes in postgis_proc_upgrade.pl to retain rules. git-svn-id: http://svn.osgeo.org/postgis/trunk@8749 b70326c6-7e19-0410-871a-916f4a2858ee --- postgis/postgis.sql.in.c | 14 ++++++++++++++ utils/postgis_proc_upgrade.pl | 11 +++++++++++ 2 files changed, 25 insertions(+) diff --git a/postgis/postgis.sql.in.c b/postgis/postgis.sql.in.c index 1536cdf0d..c454925e3 100644 --- a/postgis/postgis.sql.in.c +++ b/postgis/postgis.sql.in.c @@ -4345,6 +4345,20 @@ CREATE OR REPLACE VIEW geometry_columns AS AND c.relnamespace = n.oid AND (c.relkind = 'r'::"char" OR c.relkind = 'v'::"char") AND NOT pg_is_other_temp_schema(c.relnamespace); +-- TODO: support RETURNING and raise a WARNING +CREATE OR REPLACE RULE geometry_columns_insert AS + ON INSERT TO geometry_columns + DO INSTEAD NOTHING; + +-- TODO: raise a WARNING +CREATE OR REPLACE RULE geometry_columns_update AS + ON UPDATE TO geometry_columns + DO INSTEAD NOTHING; + +-- TODO: raise a WARNING +CREATE OR REPLACE RULE geometry_columns_delete AS + ON DELETE TO geometry_columns + DO INSTEAD NOTHING; --------------------------------------------------------------- diff --git a/utils/postgis_proc_upgrade.pl b/utils/postgis_proc_upgrade.pl index 4b4e9814c..946a49b6f 100755 --- a/utils/postgis_proc_upgrade.pl +++ b/utils/postgis_proc_upgrade.pl @@ -257,6 +257,17 @@ while() } } + # Always output create ore replace rule + if ( /^create or replace rule\s+(\S+)\s*/i ) + { + print; + while() + { + print; + last if /\;\s*$/; + } + } + # This code handles operator classes by creating them if we are doing a major upgrade if ( /^create operator class\s+(\w+)\s*/i ) { -- 2.40.0