[open-ils-commits] r14994 - branches/rel_1_4_0/Open-ILS/src/sql/Pg (dbs)

svn at svn.open-ils.org svn at svn.open-ils.org
Fri Nov 20 17:04:14 EST 2009


Author: dbs
Date: 2009-11-20 17:04:08 -0500 (Fri, 20 Nov 2009)
New Revision: 14994

Added:
   branches/rel_1_4_0/Open-ILS/src/sql/Pg/1.4.0.7-1.4.0.8-upgrade-db.sql
Modified:
   branches/rel_1_4_0/Open-ILS/src/sql/Pg/reporter-schema.sql
Log:
Backport a safer version of the reporter.disable_materialized_simple_record_trigger () function

This one works with PostgreSQL 8.1 and up, so it's targeted to the 1.4 branch


Copied: branches/rel_1_4_0/Open-ILS/src/sql/Pg/1.4.0.7-1.4.0.8-upgrade-db.sql (from rev 14993, branches/rel_1_4/Open-ILS/src/sql/Pg/1.4.0.7-1.4.0.8-upgrade-db.sql)
===================================================================
--- branches/rel_1_4_0/Open-ILS/src/sql/Pg/1.4.0.7-1.4.0.8-upgrade-db.sql	                        (rev 0)
+++ branches/rel_1_4_0/Open-ILS/src/sql/Pg/1.4.0.7-1.4.0.8-upgrade-db.sql	2009-11-20 22:04:08 UTC (rev 14994)
@@ -0,0 +1,30 @@
+/*
+ * Copyright (C) 2009  Equinox Software, Inc.
+ * Mike Rylander <miker at esilibrary.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+
+
+INSERT INTO config.upgrade_log (version) VALUES ('1.4.0.8');
+
+CREATE OR REPLACE FUNCTION reporter.disable_materialized_simple_record_trigger () RETURNS VOID AS $$
+    DECLARE x RECORD;
+    BEGIN
+        -- DROP TRIGGER IF EXISTS is only available starting with PostgreSQL 8.2
+        FOR x IN SELECT tgname FROM pg_trigger WHERE tgname = 'zzz_update_materialized_simple_record_tgr'
+        LOOP
+            DROP TRIGGER zzz_update_materialized_simple_record_tgr ON metabib.real_full_rec;
+        END LOOP;
+    END;
+$$ LANGUAGE plpgsql;
+

Modified: branches/rel_1_4_0/Open-ILS/src/sql/Pg/reporter-schema.sql
===================================================================
--- branches/rel_1_4_0/Open-ILS/src/sql/Pg/reporter-schema.sql	2009-11-20 22:01:23 UTC (rev 14993)
+++ branches/rel_1_4_0/Open-ILS/src/sql/Pg/reporter-schema.sql	2009-11-20 22:04:08 UTC (rev 14994)
@@ -203,8 +203,15 @@
     FOR EACH ROW EXECUTE PROCEDURE reporter.simple_rec_sync();
 
 CREATE OR REPLACE FUNCTION reporter.disable_materialized_simple_record_trigger () RETURNS VOID AS $$
-    DROP TRIGGER zzz_update_materialized_simple_record_tgr ON metabib.real_full_rec;
-$$ LANGUAGE SQL;
+    DECLARE x RECORD;
+    BEGIN
+        -- DROP TRIGGER IF EXISTS is only available starting with PostgreSQL 8.2
+        FOR x IN SELECT tgname FROM pg_trigger WHERE tgname = 'zzz_update_materialized_simple_record_tgr'
+        LOOP
+            DROP TRIGGER zzz_update_materialized_simple_record_tgr ON metabib.real_full_rec;
+        END LOOP;
+    END;
+$$ LANGUAGE plpgsql;
 
 CREATE OR REPLACE FUNCTION reporter.enable_materialized_simple_record_trigger () RETURNS VOID AS $$
 



More information about the open-ils-commits mailing list