From 50c05dd6bf1a24082c4193b88c167142bb95444e Mon Sep 17 00:00:00 2001 From: Jason Stephenson Date: Thu, 25 Apr 2019 18:11:59 -0400 Subject: [PATCH] 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 Signed-off-by: Ben Shum Signed-off-by: Jason Boyer --- Open-ILS/src/sql/Pg/012.schema.vandelay.sql | 4 ++-- Open-ILS/src/sql/Pg/upgrade/XXXX.schema.lp1820339-pg10-vandelay.sql | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) 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 -- 2.11.0