[open-ils-commits] [GIT] Evergreen ILS branch master updated. 296bf51baf2e2b6e74f9ae09156c876fa01d0859
Evergreen Git
git at git.evergreen-ils.org
Wed May 8 10:51:43 EDT 2019
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Evergreen ILS".
The branch, master has been updated
via 296bf51baf2e2b6e74f9ae09156c876fa01d0859 (commit)
via 50c05dd6bf1a24082c4193b88c167142bb95444e (commit)
via 4ce058763027e724ee2bfc3b339a0dc77ad61107 (commit)
from e5ba0eddecddb398f7b8f4f980b5dd0f126024b8 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 296bf51baf2e2b6e74f9ae09156c876fa01d0859
Author: Jason Boyer <jboyer at library.in.gov>
Date: Wed May 8 10:43:02 2019 -0400
Stamping upgrade script for Vandelay on PG10
Signed-off-by: Jason Boyer <jboyer at library.in.gov>
diff --git a/Open-ILS/src/sql/Pg/002.schema.config.sql b/Open-ILS/src/sql/Pg/002.schema.config.sql
index 7abca1e773..93f7ea78e1 100644
--- a/Open-ILS/src/sql/Pg/002.schema.config.sql
+++ b/Open-ILS/src/sql/Pg/002.schema.config.sql
@@ -92,7 +92,7 @@ CREATE TRIGGER no_overlapping_deps
BEFORE INSERT OR UPDATE ON config.db_patch_dependencies
FOR EACH ROW EXECUTE PROCEDURE evergreen.array_overlap_check ('deprecates');
-INSERT INTO config.upgrade_log (version, applied_to) VALUES ('1162', :eg_version); -- berick/Bmagic
+INSERT INTO config.upgrade_log (version, applied_to) VALUES ('1163', :eg_version); -- JBoyer/Dyrcona/bshum/JBoyer
CREATE TABLE config.bib_source (
id SERIAL PRIMARY KEY,
diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.lp1820339-pg10-vandelay.sql b/Open-ILS/src/sql/Pg/upgrade/1163.schema.lp1820339-pg10-vandelay.sql
similarity index 92%
rename from Open-ILS/src/sql/Pg/upgrade/XXXX.schema.lp1820339-pg10-vandelay.sql
rename to Open-ILS/src/sql/Pg/upgrade/1163.schema.lp1820339-pg10-vandelay.sql
index 86b18ea664..d9dd6e3392 100644
--- a/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.lp1820339-pg10-vandelay.sql
+++ b/Open-ILS/src/sql/Pg/upgrade/1163.schema.lp1820339-pg10-vandelay.sql
@@ -1,6 +1,6 @@
BEGIN;
-SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version);
+SELECT evergreen.upgrade_deps_block_check('1163', :eg_version); -- JBoyer/Dyrcona/bshum/JBoyer
CREATE OR REPLACE FUNCTION vandelay.flatten_marc_hstore(
record_xml TEXT
commit 50c05dd6bf1a24082c4193b88c167142bb95444e
Author: Jason Stephenson <jason at sigio.com>
Date: Thu Apr 25 18:11:59 2019 -0400
LP1820339: Vandelay Imports on Pg 10
The previous commit used a function that only exists in Pg 10, so it
would require everyone to upgrade PostgreSQL.
After some investigation, Ben Shum and I found a method that works on
Pg 9.4 through Pg 10 by putting the existing function into a
subselect as suggested by PostgreSQL documentation.
Signed-off-by: Jason Stephenson <jason at sigio.com>
Signed-off-by: Ben Shum <ben at evergreener.net>
Signed-off-by: Jason Boyer <jboyer at library.in.gov>
diff --git a/Open-ILS/src/sql/Pg/012.schema.vandelay.sql b/Open-ILS/src/sql/Pg/012.schema.vandelay.sql
index 5a11ac6816..b22677cce7 100644
--- a/Open-ILS/src/sql/Pg/012.schema.vandelay.sql
+++ b/Open-ILS/src/sql/Pg/012.schema.vandelay.sql
@@ -632,9 +632,9 @@ BEGIN
FROM (SELECT tag,
subfield,
CASE WHEN tag = '020' THEN -- caseless -- isbn
- LOWER((REGEXP_MATCH(value,$$^(\S{10,17})$$))[1] || '%')
+ LOWER((SELECT REGEXP_MATCHES(value,$$^(\S{10,17})$$))[1] || '%')
WHEN tag = '022' THEN -- caseless -- issn
- LOWER((REGEXP_MATCH(value,$$^(\S{4}[- ]?\S{4})$$))[1] || '%')
+ LOWER((SELECT REGEXP_MATCHES(value,$$^(\S{4}[- ]?\S{4})$$))[1] || '%')
WHEN tag = '024' THEN -- caseless -- upc (other)
LOWER(value || '%')
ELSE
diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.lp1820339-pg10-vandelay.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.lp1820339-pg10-vandelay.sql
index 1f7416cc75..86b18ea664 100644
--- a/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.lp1820339-pg10-vandelay.sql
+++ b/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.lp1820339-pg10-vandelay.sql
@@ -16,9 +16,9 @@ BEGIN
FROM (SELECT tag,
subfield,
CASE WHEN tag = '020' THEN -- caseless -- isbn
- LOWER((REGEXP_MATCH(value,$$^(\S{10,17})$$))[1] || '%')
+ LOWER((SELECT REGEXP_MATCHES(value,$$^(\S{10,17})$$))[1] || '%')
WHEN tag = '022' THEN -- caseless -- issn
- LOWER((REGEXP_MATCH(value,$$^(\S{4}[- ]?\S{4})$$))[1] || '%')
+ LOWER((SELECT REGEXP_MATCHES(value,$$^(\S{4}[- ]?\S{4})$$))[1] || '%')
WHEN tag = '024' THEN -- caseless -- upc (other)
LOWER(value || '%')
ELSE
commit 4ce058763027e724ee2bfc3b339a0dc77ad61107
Author: Jason Boyer <jboyer at library.in.gov>
Date: Fri Mar 15 15:35:26 2019 -0400
LP1820339: Vandelay Imports on Pg 10
In vandelay.flatten_marc_hstore there are a couple
instances of set-returning functions used inside a
CASE statement, which Pg10 is unhappy about. This
branch changes these regexp_matches calls to use
regexp_match instead which avoids this error.
Signed-off-by: Jason Boyer <jboyer at library.in.gov>
Signed-off-by: Jason Stephenson <jason at sigio.com>
Signed-off-by: Ben Shum <ben at evergreener.net>
Signed-off-by: Jason Boyer <jboyer at library.in.gov>
diff --git a/Open-ILS/src/sql/Pg/012.schema.vandelay.sql b/Open-ILS/src/sql/Pg/012.schema.vandelay.sql
index 18268f465a..5a11ac6816 100644
--- a/Open-ILS/src/sql/Pg/012.schema.vandelay.sql
+++ b/Open-ILS/src/sql/Pg/012.schema.vandelay.sql
@@ -632,9 +632,9 @@ BEGIN
FROM (SELECT tag,
subfield,
CASE WHEN tag = '020' THEN -- caseless -- isbn
- LOWER((REGEXP_MATCHES(value,$$^(\S{10,17})$$))[1] || '%')
+ LOWER((REGEXP_MATCH(value,$$^(\S{10,17})$$))[1] || '%')
WHEN tag = '022' THEN -- caseless -- issn
- LOWER((REGEXP_MATCHES(value,$$^(\S{4}[- ]?\S{4})$$))[1] || '%')
+ LOWER((REGEXP_MATCH(value,$$^(\S{4}[- ]?\S{4})$$))[1] || '%')
WHEN tag = '024' THEN -- caseless -- upc (other)
LOWER(value || '%')
ELSE
diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.lp1820339-pg10-vandelay.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.lp1820339-pg10-vandelay.sql
new file mode 100644
index 0000000000..1f7416cc75
--- /dev/null
+++ b/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.lp1820339-pg10-vandelay.sql
@@ -0,0 +1,34 @@
+BEGIN;
+
+SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version);
+
+CREATE OR REPLACE FUNCTION vandelay.flatten_marc_hstore(
+ record_xml TEXT
+) RETURNS HSTORE AS $func$
+BEGIN
+ RETURN (SELECT
+ HSTORE(
+ ARRAY_AGG(tag || (COALESCE(subfield, ''))),
+ ARRAY_AGG(value)
+ )
+ FROM (
+ SELECT tag, subfield, ARRAY_AGG(value)::TEXT AS value
+ FROM (SELECT tag,
+ subfield,
+ CASE WHEN tag = '020' THEN -- caseless -- isbn
+ LOWER((REGEXP_MATCH(value,$$^(\S{10,17})$$))[1] || '%')
+ WHEN tag = '022' THEN -- caseless -- issn
+ LOWER((REGEXP_MATCH(value,$$^(\S{4}[- ]?\S{4})$$))[1] || '%')
+ WHEN tag = '024' THEN -- caseless -- upc (other)
+ LOWER(value || '%')
+ ELSE
+ value
+ END AS value
+ FROM vandelay.flatten_marc(record_xml)) x
+ GROUP BY tag, subfield ORDER BY tag, subfield
+ ) subquery
+ );
+END;
+$func$ LANGUAGE PLPGSQL;
+
+COMMIT;
-----------------------------------------------------------------------
Summary of changes:
Open-ILS/src/sql/Pg/002.schema.config.sql | 2 +-
Open-ILS/src/sql/Pg/012.schema.vandelay.sql | 4 +--
.../1163.schema.lp1820339-pg10-vandelay.sql | 34 ++++++++++++++++++++++
3 files changed, 37 insertions(+), 3 deletions(-)
create mode 100644 Open-ILS/src/sql/Pg/upgrade/1163.schema.lp1820339-pg10-vandelay.sql
hooks/post-receive
--
Evergreen ILS
More information about the open-ils-commits
mailing list