[open-ils-commits] r18362 - branches/rel_1_6_0/Open-ILS/src/sql/Pg (gmc)
svn at svn.open-ils.org
svn at svn.open-ils.org
Sat Oct 16 03:05:39 EDT 2010
Author: gmc
Date: 2010-10-16 03:05:35 -0400 (Sat, 16 Oct 2010)
New Revision: 18362
Modified:
branches/rel_1_6_0/Open-ILS/src/sql/Pg/1.6.0.3-1.6.0.4-upgrade-db.sql
branches/rel_1_6_0/Open-ILS/src/sql/Pg/1.6.0.4-1.6.0.5-upgrade-db.sql
branches/rel_1_6_0/Open-ILS/src/sql/Pg/1.6.0.8-1.6.0.9-upgrade-db.sql
Log:
yet more backporting of r17243 + restore better ISSN extraction
In particular, avoid failure in 1.6.0.3=1.6.0.4.sql
if dataset contains bibs with more than one 245$a
Signed-off-by: Galen Charlton <gmc at esilibrary.com>
Modified: branches/rel_1_6_0/Open-ILS/src/sql/Pg/1.6.0.3-1.6.0.4-upgrade-db.sql
===================================================================
--- branches/rel_1_6_0/Open-ILS/src/sql/Pg/1.6.0.3-1.6.0.4-upgrade-db.sql 2010-10-16 06:56:48 UTC (rev 18361)
+++ branches/rel_1_6_0/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)
@@ -70,25 +70,25 @@
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!
Modified: branches/rel_1_6_0/Open-ILS/src/sql/Pg/1.6.0.4-1.6.0.5-upgrade-db.sql
===================================================================
--- branches/rel_1_6_0/Open-ILS/src/sql/Pg/1.6.0.4-1.6.0.5-upgrade-db.sql 2010-10-16 06:56:48 UTC (rev 18361)
+++ branches/rel_1_6_0/Open-ILS/src/sql/Pg/1.6.0.4-1.6.0.5-upgrade-db.sql 2010-10-16 07:05:35 UTC (rev 18362)
@@ -149,14 +149,13 @@
END;
$func$ LANGUAGE plpgsql;
--- allow more than one 260 in summary data
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(title.value) AS title,
FIRST(author.value) AS author,
ARRAY_TO_STRING(ARRAY_ACCUM( DISTINCT publisher.value), ', ') AS publisher,
ARRAY_TO_STRING(ARRAY_ACCUM( DISTINCT SUBSTRING(pubdate.value FROM $$\d+$$) ), ', ') AS pubdate,
@@ -169,7 +168,6 @@
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;
+ GROUP BY 1,2,3,4,5;
-
COMMIT;
Modified: branches/rel_1_6_0/Open-ILS/src/sql/Pg/1.6.0.8-1.6.0.9-upgrade-db.sql
===================================================================
--- branches/rel_1_6_0/Open-ILS/src/sql/Pg/1.6.0.8-1.6.0.9-upgrade-db.sql 2010-10-16 06:56:48 UTC (rev 18361)
+++ branches/rel_1_6_0/Open-ILS/src/sql/Pg/1.6.0.8-1.6.0.9-upgrade-db.sql 2010-10-16 07:05:35 UTC (rev 18362)
@@ -21,4 +21,25 @@
DROP INDEX asset.asset_call_number_upper_label_id_owning_lib_idx;
CREATE INDEX asset_call_number_upper_label_id_owning_lib_idx ON asset.call_number (cast(upper(label) as bytea),id,owning_lib);
+CREATE OR REPLACE VIEW reporter.old_super_simple_record AS
+SELECT r.id,
+ r.fingerprint,
+ r.quality,
+ r.tcn_source,
+ r.tcn_value,
+ FIRST(title.value) AS title,
+ FIRST(author.value) AS author,
+ 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
+ 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;
+
COMMIT;
More information about the open-ils-commits
mailing list