[open-ils-commits] r18678 - in branches/rel_2_0/Open-ILS/src/sql/Pg: . upgrade (gmc)
svn at svn.open-ils.org
svn at svn.open-ils.org
Wed Nov 10 08:19:04 EST 2010
Author: gmc
Date: 2010-11-10 08:19:03 -0500 (Wed, 10 Nov 2010)
New Revision: 18678
Added:
branches/rel_2_0/Open-ILS/src/sql/Pg/upgrade/0462.schema.no-truncate-during-bib-view-refresh.sql
Modified:
branches/rel_2_0/Open-ILS/src/sql/Pg/002.schema.config.sql
branches/rel_2_0/Open-ILS/src/sql/Pg/reporter-schema.sql
Log:
do not use TRUNCATE when refreshing reporter.materialized_simple_record
Previous behavior would break Slony replication after doing a
bib load. Since a deletion is slower than a truncate, if you're
not using Slony replication, you may prefer to truncate rmsr
prior to calling reporter.enable_materialized_simple_record_trigger.
Signed-off-by: Galen Charlton <gmc at esilibrary.com>
Modified: branches/rel_2_0/Open-ILS/src/sql/Pg/002.schema.config.sql
===================================================================
--- branches/rel_2_0/Open-ILS/src/sql/Pg/002.schema.config.sql 2010-11-10 13:18:29 UTC (rev 18677)
+++ branches/rel_2_0/Open-ILS/src/sql/Pg/002.schema.config.sql 2010-11-10 13:19:03 UTC (rev 18678)
@@ -70,7 +70,7 @@
install_date TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW()
);
-INSERT INTO config.upgrade_log (version) VALUES ('0461'); -- miker
+INSERT INTO config.upgrade_log (version) VALUES ('0462'); -- gmc
CREATE TABLE config.bib_source (
id SERIAL PRIMARY KEY,
Modified: branches/rel_2_0/Open-ILS/src/sql/Pg/reporter-schema.sql
===================================================================
--- branches/rel_2_0/Open-ILS/src/sql/Pg/reporter-schema.sql 2010-11-10 13:18:29 UTC (rev 18677)
+++ branches/rel_2_0/Open-ILS/src/sql/Pg/reporter-schema.sql 2010-11-10 13:19:03 UTC (rev 18678)
@@ -261,7 +261,7 @@
CREATE OR REPLACE FUNCTION reporter.enable_materialized_simple_record_trigger () RETURNS VOID AS $$
- TRUNCATE TABLE reporter.materialized_simple_record;
+ DELETE FROM reporter.materialized_simple_record;
INSERT INTO reporter.materialized_simple_record
(id,fingerprint,quality,tcn_source,tcn_value,title,author,publisher,pubdate,isbn,issn)
Copied: branches/rel_2_0/Open-ILS/src/sql/Pg/upgrade/0462.schema.no-truncate-during-bib-view-refresh.sql (from rev 18677, trunk/Open-ILS/src/sql/Pg/upgrade/0462.schema.no-truncate-during-bib-view-refresh.sql)
===================================================================
--- branches/rel_2_0/Open-ILS/src/sql/Pg/upgrade/0462.schema.no-truncate-during-bib-view-refresh.sql (rev 0)
+++ branches/rel_2_0/Open-ILS/src/sql/Pg/upgrade/0462.schema.no-truncate-during-bib-view-refresh.sql 2010-11-10 13:19:03 UTC (rev 18678)
@@ -0,0 +1,19 @@
+BEGIN;
+
+INSERT INTO config.upgrade_log (version) VALUES ('0462'); -- gmc
+
+CREATE OR REPLACE FUNCTION reporter.enable_materialized_simple_record_trigger () RETURNS VOID AS $$
+
+ DELETE FROM reporter.materialized_simple_record;
+
+ INSERT INTO reporter.materialized_simple_record
+ (id,fingerprint,quality,tcn_source,tcn_value,title,author,publisher,pubdate,isbn,issn)
+ SELECT DISTINCT ON (id) * FROM reporter.old_super_simple_record;
+
+ CREATE TRIGGER zzz_update_materialized_simple_record_tgr
+ AFTER INSERT OR UPDATE OR DELETE ON metabib.real_full_rec
+ FOR EACH ROW EXECUTE PROCEDURE reporter.simple_rec_sync();
+
+$$ LANGUAGE SQL;
+
+COMMIT;
More information about the open-ils-commits
mailing list