[open-ils-commits] r18363 - branches/rel_1_6/Open-ILS/src/sql/Pg (gmc)

svn at svn.open-ils.org svn at svn.open-ils.org
Sat Oct 16 03:08:06 EDT 2010


Author: gmc
Date: 2010-10-16 03:08:01 -0400 (Sat, 16 Oct 2010)
New Revision: 18363

Modified:
   branches/rel_1_6/Open-ILS/src/sql/Pg/1.6.0.3-1.6.0.4-upgrade-db.sql
Log:
sync 1.6.0.3-1.6.0.4-upgrade-db.sql from rel_1_6_0

Signed-off-by: Galen Charlton <gmc at esilibrary.com>


Modified: branches/rel_1_6/Open-ILS/src/sql/Pg/1.6.0.3-1.6.0.4-upgrade-db.sql
===================================================================
--- branches/rel_1_6/Open-ILS/src/sql/Pg/1.6.0.3-1.6.0.4-upgrade-db.sql	2010-10-16 07:05:35 UTC (rev 18362)
+++ branches/rel_1_6/Open-ILS/src/sql/Pg/1.6.0.3-1.6.0.4-upgrade-db.sql	2010-10-16 07:08:01 UTC (rev 18363)
@@ -70,33 +70,33 @@
 
 
 CREATE OR REPLACE VIEW reporter.old_super_simple_record AS
-SELECT	r.id,
+SELECT  r.id,
 	r.fingerprint,
 	r.quality,
 	r.tcn_source,
 	r.tcn_value,
-	title.value AS title,
+	FIRST(title.value) AS title,
 	FIRST(author.value) AS author,
-	publisher.value AS publisher,
-	SUBSTRING(pubdate.value FROM $$\d+$$) AS pubdate,
+	ARRAY_TO_STRING(ARRAY_ACCUM( DISTINCT publisher.value), ', ') AS publisher,
+	ARRAY_TO_STRING(ARRAY_ACCUM( DISTINCT SUBSTRING(pubdate.value FROM $$\d+$$) ), ', ') AS pubdate,
 	ARRAY_ACCUM( DISTINCT SUBSTRING(isbn.value FROM $$^\S+$$) ) AS isbn,
 	ARRAY_ACCUM( DISTINCT SUBSTRING(REGEXP_REPLACE(issn.value, E'^\\s*(\\d{4})[-\\s](\\d{3,4}x?)\\s*', E'\\1 \\2') FROM 1 FOR 9) ) AS issn
-  FROM biblio.record_entry r
+  FROM  biblio.record_entry r
 	LEFT JOIN metabib.full_rec title ON (r.id = title.record AND title.tag = '245' AND title.subfield = 'a')
 	LEFT JOIN metabib.full_rec author ON (r.id = author.record AND author.tag IN ('100','110','111') AND author.subfield = 'a')
 	LEFT JOIN metabib.full_rec publisher ON (r.id = publisher.record AND publisher.tag = '260' AND publisher.subfield = 'b')
 	LEFT JOIN metabib.full_rec pubdate ON (r.id = pubdate.record AND pubdate.tag = '260' AND pubdate.subfield = 'c')
 	LEFT JOIN metabib.full_rec isbn ON (r.id = isbn.record AND isbn.tag IN ('024', '020') AND isbn.subfield IN ('a','z'))
 	LEFT JOIN metabib.full_rec issn ON (r.id = issn.record AND issn.tag = '022' AND issn.subfield = 'a')
-  GROUP BY 1,2,3,4,5,6,8,9;
+  GROUP BY 1,2,3,4,5;
 
 -- Now rebuild the materialized simple record table that was built on reporter.old_super_simple_record
 -- If you're using Slony, delete instead of truncate!
 
---DELETE FROM materialized.simple_record;
+--DELETE FROM reporter.materialized_simple_record;
 TRUNCATE TABLE reporter.materialized_simple_record;
 
-INSERT INTO reporter.materialized_simple_record
+INSERT INTO reporter.materialized_simple_record 
     SELECT * FROM reporter.old_super_simple_record;
 
 -- Replace the billable transaction summary view with one that is more cautious about NULL values
@@ -152,6 +152,9 @@
 $$ LANGUAGE PLPGSQL;
 
 -- And rebuild the materialized view that was built on money.billable_xact_summary
+-- If you're using Slony, delete instead of truncate!
+
+-- DELETE FROM money.materialized_billable_xact_summary;
 TRUNCATE TABLE money.materialized_billable_xact_summary;
 INSERT INTO money.materialized_billable_xact_summary
 	SELECT * FROM money.billable_xact_summary;



More information about the open-ils-commits mailing list