From: Ben Shum Date: Fri, 5 Dec 2014 20:59:40 +0000 (-0500) Subject: Re-order parts of 0887 upgrade script X-Git-Tag: sprint4-merge-nov22~1773 X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=e9fa80881f6cbe90fc675c3f4eb7169aa2ddb5db;p=working%2FEvergreen.git Re-order parts of 0887 upgrade script Based on feedback from dbs, in PostgreSQL 9.1, the order to which we fix up these functions matters. So drop if exists first, then create new. Signed-off-by: Ben Shum --- diff --git a/Open-ILS/src/sql/Pg/upgrade/0887.function.no-ff-defaults.sql b/Open-ILS/src/sql/Pg/upgrade/0887.function.no-ff-defaults.sql index 604add157a..7763f7e479 100644 --- a/Open-ILS/src/sql/Pg/upgrade/0887.function.no-ff-defaults.sql +++ b/Open-ILS/src/sql/Pg/upgrade/0887.function.no-ff-defaults.sql @@ -2,6 +2,8 @@ BEGIN; SELECT evergreen.upgrade_deps_block_check('0887', :eg_version); +DROP FUNCTION IF EXISTS vandelay.marc21_extract_fixed_field_list( text, text ); + CREATE OR REPLACE FUNCTION vandelay.marc21_extract_fixed_field_list( marc TEXT, ff TEXT, use_default BOOL DEFAULT FALSE ) RETURNS TEXT[] AS $func$ DECLARE rtype TEXT; @@ -34,6 +36,8 @@ BEGIN END; $func$ LANGUAGE PLPGSQL; +DROP FUNCTION IF EXISTS vandelay.marc21_extract_fixed_field( text, text ); + CREATE OR REPLACE FUNCTION vandelay.marc21_extract_fixed_field( marc TEXT, ff TEXT, use_default BOOL DEFAULT FALSE ) RETURNS TEXT AS $func$ DECLARE rtype TEXT; @@ -64,6 +68,8 @@ BEGIN END; $func$ LANGUAGE PLPGSQL; +DROP FUNCTION IF EXISTS vandelay.marc21_extract_all_fixed_fields( text ); + CREATE OR REPLACE FUNCTION vandelay.marc21_extract_all_fixed_fields( marc TEXT, use_default BOOL DEFAULT FALSE ) RETURNS SETOF biblio.record_ff_map AS $func$ DECLARE tag_data TEXT; @@ -112,9 +118,5 @@ CREATE OR REPLACE FUNCTION biblio.marc21_extract_all_fixed_fields( rid BIGINT ) SELECT $1 AS record, ff_name, ff_value FROM vandelay.marc21_extract_all_fixed_fields( (SELECT marc FROM biblio.record_entry WHERE id = $1), TRUE ); $func$ LANGUAGE SQL; -DROP FUNCTION IF EXISTS vandelay.marc21_extract_fixed_field_list( text, text ); -DROP FUNCTION IF EXISTS vandelay.marc21_extract_fixed_field( text, text ); -DROP FUNCTION IF EXISTS vandelay.marc21_extract_all_fixed_fields( text ); - COMMIT; diff --git a/Open-ILS/src/sql/Pg/version-upgrade/2.6.2-2.6.3-upgrade-db.sql b/Open-ILS/src/sql/Pg/version-upgrade/2.6.2-2.6.3-upgrade-db.sql index 835e022bf6..be6c5f3286 100644 --- a/Open-ILS/src/sql/Pg/version-upgrade/2.6.2-2.6.3-upgrade-db.sql +++ b/Open-ILS/src/sql/Pg/version-upgrade/2.6.2-2.6.3-upgrade-db.sql @@ -5,6 +5,8 @@ INSERT INTO config.upgrade_log (version, applied_to) VALUES ('2.6.3', :eg_versio SELECT evergreen.upgrade_deps_block_check('0887', :eg_version); +DROP FUNCTION IF EXISTS vandelay.marc21_extract_fixed_field_list( text, text ); + CREATE OR REPLACE FUNCTION vandelay.marc21_extract_fixed_field_list( marc TEXT, ff TEXT, use_default BOOL DEFAULT FALSE ) RETURNS TEXT[] AS $func$ DECLARE rtype TEXT; @@ -37,6 +39,8 @@ BEGIN END; $func$ LANGUAGE PLPGSQL; +DROP FUNCTION IF EXISTS vandelay.marc21_extract_fixed_field( text, text ); + CREATE OR REPLACE FUNCTION vandelay.marc21_extract_fixed_field( marc TEXT, ff TEXT, use_default BOOL DEFAULT FALSE ) RETURNS TEXT AS $func$ DECLARE rtype TEXT; @@ -67,6 +71,8 @@ BEGIN END; $func$ LANGUAGE PLPGSQL; +DROP FUNCTION IF EXISTS vandelay.marc21_extract_all_fixed_fields( text ); + CREATE OR REPLACE FUNCTION vandelay.marc21_extract_all_fixed_fields( marc TEXT, use_default BOOL DEFAULT FALSE ) RETURNS SETOF biblio.record_ff_map AS $func$ DECLARE tag_data TEXT; @@ -115,11 +121,6 @@ CREATE OR REPLACE FUNCTION biblio.marc21_extract_all_fixed_fields( rid BIGINT ) SELECT $1 AS record, ff_name, ff_value FROM vandelay.marc21_extract_all_fixed_fields( (SELECT marc FROM biblio.record_entry WHERE id = $1), TRUE ); $func$ LANGUAGE SQL; -DROP FUNCTION IF EXISTS vandelay.marc21_extract_fixed_field_list( text, text ); -DROP FUNCTION IF EXISTS vandelay.marc21_extract_fixed_field( text, text ); -DROP FUNCTION IF EXISTS vandelay.marc21_extract_all_fixed_fields( text ); - - SELECT evergreen.upgrade_deps_block_check('0890', :eg_version);