[open-ils-commits] r14159 - in trunk/Open-ILS/src/sql/Pg: . upgrade (miker)
svn at svn.open-ils.org
svn at svn.open-ils.org
Thu Sep 24 15:23:30 EDT 2009
Author: miker
Date: 2009-09-24 15:23:25 -0400 (Thu, 24 Sep 2009)
New Revision: 14159
Added:
trunk/Open-ILS/src/sql/Pg/upgrade/0022.schema.reporter-simple_record-materialized-view.sql
Modified:
trunk/Open-ILS/src/sql/Pg/002.schema.config.sql
trunk/Open-ILS/src/sql/Pg/reporter-schema.sql
Log:
Correcting reporting view definition with regard to ISBN and ISSN extraction
Modified: trunk/Open-ILS/src/sql/Pg/002.schema.config.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/002.schema.config.sql 2009-09-24 19:18:16 UTC (rev 14158)
+++ trunk/Open-ILS/src/sql/Pg/002.schema.config.sql 2009-09-24 19:23:25 UTC (rev 14159)
@@ -51,7 +51,7 @@
install_date TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW()
);
-INSERT INTO config.upgrade_log (version) VALUES ('0021'); -- mck9
+INSERT INTO config.upgrade_log (version) VALUES ('0022'); --miker
CREATE TABLE config.bib_source (
id SERIAL PRIMARY KEY,
Modified: trunk/Open-ILS/src/sql/Pg/reporter-schema.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/reporter-schema.sql 2009-09-24 19:18:16 UTC (rev 14158)
+++ trunk/Open-ILS/src/sql/Pg/reporter-schema.sql 2009-09-24 19:23:25 UTC (rev 14159)
@@ -158,8 +158,8 @@
FIRST(author.value) AS author,
publisher.value AS publisher,
SUBSTRING(pubdate.value FROM $$\d+$$) AS pubdate,
- ARRAY_ACCUM( SUBSTRING(isbn.value FROM $$^\S+$$) ) AS isbn,
- ARRAY_ACCUM( SUBSTRING(issn.value FROM $$^\S+$$) ) AS issn
+ ARRAY_ACCUM( DISTINCT SUBSTRING(isbn.value FROM $$^\S+$$) ) AS isbn,
+ ARRAY_ACCUM( DISTINCT SUBSTRING(issn.value FROM $$^\S+$$) ) AS issn
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')
Added: trunk/Open-ILS/src/sql/Pg/upgrade/0022.schema.reporter-simple_record-materialized-view.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/upgrade/0022.schema.reporter-simple_record-materialized-view.sql (rev 0)
+++ trunk/Open-ILS/src/sql/Pg/upgrade/0022.schema.reporter-simple_record-materialized-view.sql 2009-09-24 19:23:25 UTC (rev 14159)
@@ -0,0 +1,28 @@
+BEGIN;
+
+INSERT INTO config.upgrade_log (version) VALUES ('0022'); --miker
+
+-- Need to recreate this view with DISTINCT calls to ARRAY_ACCUM, thus avoiding duplicated ISBN and ISSN values
+CREATE OR REPLACE VIEW reporter.old_super_simple_record AS
+SELECT r.id,
+ r.fingerprint,
+ r.quality,
+ r.tcn_source,
+ r.tcn_value,
+ title.value AS title,
+ FIRST(author.value) AS author,
+ publisher.value AS publisher,
+ SUBSTRING(pubdate.value FROM $$\d+$$) AS pubdate,
+ ARRAY_ACCUM( DISTINCT SUBSTRING(isbn.value FROM $$^\S+$$) ) AS isbn,
+ ARRAY_ACCUM( DISTINCT SUBSTRING(issn.value FROM $$^\S+$$) ) AS issn
+ 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;
+
+COMMIT;
+
More information about the open-ils-commits
mailing list