From be5803f14b193e0f39b50731624c6206baa08bb1 Mon Sep 17 00:00:00 2001 From: Jeff Godin Date: Mon, 17 Feb 2014 17:12:33 +0000 Subject: [PATCH] Stamping 0857 for located uri visibility changes Stamping 0857 for located uri visibility changes, also adjusting upgrade script to use ARRAY_AGG over ARRAY_ACCUM (which recently landed in master). LP 1271630 Allow Located URIs to supply copy-like visibility to bibs https://bugs.launchpad.net/evergreen/+bug/1271630 LP 874296 Replace ARRAY_ACCUM with ARRAY_AGG (and STRING_AGG) https://bugs.launchpad.net/evergreen/+bug/874296 Signed-off-by: Jeff Godin --- Open-ILS/src/sql/Pg/002.schema.config.sql | 2 +- ...7.function.located_uris_act_as_copies.sql} | 22 ++++++++++--------- 2 files changed, 13 insertions(+), 11 deletions(-) rename Open-ILS/src/sql/Pg/upgrade/{XXXX.function.located_uris_act_as_copies.sql => 0857.function.located_uris_act_as_copies.sql} (94%) diff --git a/Open-ILS/src/sql/Pg/002.schema.config.sql b/Open-ILS/src/sql/Pg/002.schema.config.sql index fb3c0f80a0..914bf2a199 100644 --- a/Open-ILS/src/sql/Pg/002.schema.config.sql +++ b/Open-ILS/src/sql/Pg/002.schema.config.sql @@ -91,7 +91,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 ('0856', :eg_version); -- dbs/bshum +INSERT INTO config.upgrade_log (version, applied_to) VALUES ('0857', :eg_version); -- miker/jeff CREATE TABLE config.bib_source ( id SERIAL PRIMARY KEY, diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.function.located_uris_act_as_copies.sql b/Open-ILS/src/sql/Pg/upgrade/0857.function.located_uris_act_as_copies.sql similarity index 94% rename from Open-ILS/src/sql/Pg/upgrade/XXXX.function.located_uris_act_as_copies.sql rename to Open-ILS/src/sql/Pg/upgrade/0857.function.located_uris_act_as_copies.sql index 545a0bf1c6..5200eeacd7 100644 --- a/Open-ILS/src/sql/Pg/upgrade/XXXX.function.located_uris_act_as_copies.sql +++ b/Open-ILS/src/sql/Pg/upgrade/0857.function.located_uris_act_as_copies.sql @@ -17,6 +17,8 @@ BEGIN; +SELECT evergreen.upgrade_deps_block_check('0857', :eg_version); + INSERT INTO config.global_flag (name, enabled, label) VALUES ( 'opac.located_uri.act_as_copy', @@ -113,32 +115,32 @@ BEGIN IF param_search_ou > 0 THEN IF param_depth IS NOT NULL THEN - SELECT array_accum(distinct id) INTO search_org_list FROM actor.org_unit_descendants( param_search_ou, param_depth ); + SELECT ARRAY_AGG(distinct id) INTO search_org_list FROM actor.org_unit_descendants( param_search_ou, param_depth ); ELSE - SELECT array_accum(distinct id) INTO search_org_list FROM actor.org_unit_descendants( param_search_ou ); + SELECT ARRAY_AGG(distinct id) INTO search_org_list FROM actor.org_unit_descendants( param_search_ou ); END IF; IF luri_as_copy THEN - SELECT array_accum(distinct id) INTO luri_org_list FROM actor.org_unit_full_path( param_search_ou ); + SELECT ARRAY_AGG(distinct id) INTO luri_org_list FROM actor.org_unit_full_path( param_search_ou ); ELSE - SELECT array_accum(distinct id) INTO luri_org_list FROM actor.org_unit_ancestors( param_search_ou ); + SELECT ARRAY_AGG(distinct id) INTO luri_org_list FROM actor.org_unit_ancestors( param_search_ou ); END IF; ELSIF param_search_ou < 0 THEN - SELECT array_accum(distinct org_unit) INTO search_org_list FROM actor.org_lasso_map WHERE lasso = -param_search_ou; + SELECT ARRAY_AGG(distinct org_unit) INTO search_org_list FROM actor.org_lasso_map WHERE lasso = -param_search_ou; FOR tmp_int IN SELECT * FROM UNNEST(search_org_list) LOOP IF luri_as_copy THEN - SELECT array_accum(distinct id) INTO tmp_int_list FROM actor.org_unit_full_path( tmp_int ); + SELECT ARRAY_AGG(distinct id) INTO tmp_int_list FROM actor.org_unit_full_path( tmp_int ); ELSE - SELECT array_accum(distinct id) INTO tmp_int_list FROM actor.org_unit_ancestors( tmp_int ); + SELECT ARRAY_AGG(distinct id) INTO tmp_int_list FROM actor.org_unit_ancestors( tmp_int ); END IF; luri_org_list := luri_org_list || tmp_int_list; END LOOP; - SELECT array_accum(DISTINCT x.id) INTO luri_org_list FROM UNNEST(luri_org_list) x(id); + SELECT ARRAY_AGG(DISTINCT x.id) INTO luri_org_list FROM UNNEST(luri_org_list) x(id); ELSIF param_search_ou = 0 THEN -- reserved for user lassos (ou_buckets/type='lasso') with ID passed in depth ... hack? sure. @@ -146,9 +148,9 @@ BEGIN IF param_pref_ou IS NOT NULL THEN IF luri_as_copy THEN - SELECT array_accum(distinct id) INTO tmp_int_list FROM actor.org_unit_full_path( param_pref_ou ); + SELECT ARRAY_AGG(distinct id) INTO tmp_int_list FROM actor.org_unit_full_path( param_pref_ou ); ELSE - SELECT array_accum(distinct id) INTO tmp_int_list FROM actor.org_unit_ancestors( param_pref_ou ); + SELECT ARRAY_AGG(distinct id) INTO tmp_int_list FROM actor.org_unit_ancestors( param_pref_ou ); END IF; luri_org_list := luri_org_list || tmp_int_list; -- 2.43.2