[open-ils-commits] [GIT] Evergreen ILS branch rel_2_10 updated. f81ec9ce061fe093498ed3902fb6b8b4fd6fe1d3

Evergreen Git git at git.evergreen-ils.org
Thu Apr 28 11:55:54 EDT 2016


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, rel_2_10 has been updated
       via  f81ec9ce061fe093498ed3902fb6b8b4fd6fe1d3 (commit)
       via  904ad79f0a7d114454d08b2822f955e10bc7bf73 (commit)
      from  c86b93b9c3a2e49934072b2bab8388c81dfe8cf7 (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 f81ec9ce061fe093498ed3902fb6b8b4fd6fe1d3
Author: Mike Rylander <mrylander at gmail.com>
Date:   Thu Apr 28 11:54:28 2016 -0400

    LP#1568195: Stamping upgrade script
    
    Signed-off-by: Mike Rylander <mrylander at gmail.com>

diff --git a/Open-ILS/src/sql/Pg/002.schema.config.sql b/Open-ILS/src/sql/Pg/002.schema.config.sql
index 95766bf..fc8f13e 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 ('0977', :eg_version); -- Callender/Dyrcona/gmcharlt
+INSERT INTO config.upgrade_log (version, applied_to) VALUES ('0978', :eg_version); -- gmcharlt/miker
 
 CREATE TABLE config.bib_source (
 	id		SERIAL	PRIMARY KEY,
diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.make_ous_batch_retrieve_func_nonvariadic.sql b/Open-ILS/src/sql/Pg/upgrade/0978.schema.make_ous_batch_retrieve_func_nonvariadic.sql
similarity index 94%
rename from Open-ILS/src/sql/Pg/upgrade/XXXX.schema.make_ous_batch_retrieve_func_nonvariadic.sql
rename to Open-ILS/src/sql/Pg/upgrade/0978.schema.make_ous_batch_retrieve_func_nonvariadic.sql
index f933345..cbb7b1c 100644
--- a/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.make_ous_batch_retrieve_func_nonvariadic.sql
+++ b/Open-ILS/src/sql/Pg/upgrade/0978.schema.make_ous_batch_retrieve_func_nonvariadic.sql
@@ -1,6 +1,6 @@
 BEGIN;
 
---SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version);
+SELECT evergreen.upgrade_deps_block_check('0978', :eg_version);
 
 -- note: it is not necessary to explicitly drop the previous VARIADIC
 -- version of this stored procedure; create or replace function...

commit 904ad79f0a7d114454d08b2822f955e10bc7bf73
Author: Galen Charlton <gmc at esilibrary.com>
Date:   Fri Apr 8 21:46:35 2016 -0400

    LP#1568195: fix retrieving big OUS batches
    
    This patch fixes a regression introduced in LP#1501471
    where the Library Settings Editor could fail to retrieve
    the values of org unit settings if more than 99 were
    requested at a time.
    
    To test
    -------
    [1] Open the XUL library settings editor and ensure that
        no search filters are in effect. Note that values
        are not displayed for any of the OU settings, and that
        the Pg log contains error messages like this:
    
        "ERROR: cannot pass more than 100 arguments to a function"
    
    [2] Apply the patch.
    [3] Repeat step one, and verify that values are now retrieved
        for all of the OU settings that have values set.
    [4] Verify that the pgTAP tests in live_t/aous_batch.pg pass.
    
    Signed-off-by: Galen Charlton <gmc at esilibrary.com>
    Signed-off-by: Mike Rylander <mrylander at gmail.com>

diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/AppUtils.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/AppUtils.pm
index 1378a47..5f4714b 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/AppUtils.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/AppUtils.pm
@@ -1315,7 +1315,13 @@ sub ou_ancestor_setting_batch_insecure {
     my( $self, $orgid, $names ) = @_;
 
     my %result = map { $_ => undef } @$names;
-    my $query = {from => ['actor.org_unit_ancestor_setting_batch', $orgid, @$names]};
+    my $query = {
+        from => [
+            'actor.org_unit_ancestor_setting_batch',
+            $orgid,
+            '{' . join(',', @$names) . '}'
+        ]
+    };
     my $e = OpenILS::Utils::CStoreEditor->new();
     my $settings = $e->json_query($query);
     foreach my $setting (@$settings) {
diff --git a/Open-ILS/src/sql/Pg/020.schema.functions.sql b/Open-ILS/src/sql/Pg/020.schema.functions.sql
index 71b5116..7cc5be0 100644
--- a/Open-ILS/src/sql/Pg/020.schema.functions.sql
+++ b/Open-ILS/src/sql/Pg/020.schema.functions.sql
@@ -293,7 +293,7 @@ Search "up" the org_unit tree until we find the first occurrence of an
 org_unit_setting with the given name.
 $$;
 
-CREATE OR REPLACE FUNCTION actor.org_unit_ancestor_setting_batch( org_id INT, VARIADIC setting_names TEXT[] ) RETURNS SETOF actor.org_unit_setting AS $$
+CREATE OR REPLACE FUNCTION actor.org_unit_ancestor_setting_batch( org_id INT, setting_names TEXT[] ) RETURNS SETOF actor.org_unit_setting AS $$
 DECLARE
     setting RECORD;
     setting_name TEXT;
@@ -316,7 +316,7 @@ BEGIN
 END;
 $$ LANGUAGE plpgsql STABLE;
 
-COMMENT ON FUNCTION actor.org_unit_ancestor_setting_batch( INT, VARIADIC TEXT[] ) IS $$
+COMMENT ON FUNCTION actor.org_unit_ancestor_setting_batch( INT,  TEXT[] ) IS $$
 For each setting name passed, search "up" the org_unit tree until
 we find the first occurrence of an org_unit_setting with the given name.
 $$;
diff --git a/Open-ILS/src/sql/Pg/live_t/aous_batch.pg b/Open-ILS/src/sql/Pg/live_t/aous_batch.pg
index 4a0dabd..87c05e5 100644
--- a/Open-ILS/src/sql/Pg/live_t/aous_batch.pg
+++ b/Open-ILS/src/sql/Pg/live_t/aous_batch.pg
@@ -10,20 +10,20 @@ INSERT INTO actor.org_unit_setting (org_unit, name, value) VALUES (2, 'foo', '"f
 INSERT INTO actor.org_unit_setting (org_unit, name, value) VALUES (2, 'bar', '"bar 2"');
 
 SELECT results_eq(
-    $$ SELECT name, value FROM actor.org_unit_ancestor_setting_batch(1, 'foo', 'bar') $$,
+    $$ SELECT name, value FROM actor.org_unit_ancestor_setting_batch(1, '{foo,bar}') $$,
     $$ VALUES ('foo', '"foo 1"') $$,
     'can retrieve batch of org unit settings'
 );
 
 SELECT results_eq(
-    $$ SELECT name, value FROM actor.org_unit_ancestor_setting_batch(2, 'foo', 'bar') $$,
+    $$ SELECT name, value FROM actor.org_unit_ancestor_setting_batch(2, '{foo,bar}') $$,
     $$ VALUES ('foo', '"foo 2"'), ('bar', '"bar 2"') $$,
     'can retrieve batch of org unit settings at lower level'
 );
 
 DELETE FROM actor.org_unit_setting WHERE name = 'foo' AND org_unit = 2;
 SELECT results_eq(
-    $$ SELECT name, value FROM actor.org_unit_ancestor_setting_batch(2, 'foo', 'bar') $$,
+    $$ SELECT name, value FROM actor.org_unit_ancestor_setting_batch(2, '{foo,bar}') $$,
     $$ VALUES ('foo', '"foo 1"'), ('bar', '"bar 2"') $$,
     'can retrieve batch of org unit settings with fallback'
 );
diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.make_ous_batch_retrieve_func_nonvariadic.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.make_ous_batch_retrieve_func_nonvariadic.sql
new file mode 100644
index 0000000..f933345
--- /dev/null
+++ b/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.make_ous_batch_retrieve_func_nonvariadic.sql
@@ -0,0 +1,36 @@
+BEGIN;
+
+--SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version);
+
+-- note: it is not necessary to explicitly drop the previous VARIADIC
+-- version of this stored procedure; create or replace function...
+-- suffices.
+CREATE OR REPLACE FUNCTION actor.org_unit_ancestor_setting_batch( org_id INT, setting_names TEXT[] ) RETURNS SETOF actor.org_unit_setting AS $$
+DECLARE
+    setting RECORD;
+    setting_name TEXT;
+    cur_org INT;
+BEGIN
+    FOREACH setting_name IN ARRAY setting_names
+    LOOP
+        cur_org := org_id;
+        LOOP
+            SELECT INTO setting * FROM actor.org_unit_setting WHERE org_unit = cur_org AND name = setting_name;
+            IF FOUND THEN
+                RETURN NEXT setting;
+                EXIT;
+            END IF;
+            SELECT INTO cur_org parent_ou FROM actor.org_unit WHERE id = cur_org;
+            EXIT WHEN cur_org IS NULL;
+        END LOOP;
+    END LOOP;
+    RETURN;
+END;
+$$ LANGUAGE plpgsql STABLE;
+
+COMMENT ON FUNCTION actor.org_unit_ancestor_setting_batch( INT,  TEXT[] ) IS $$
+For each setting name passed, search "up" the org_unit tree until
+we find the first occurrence of an org_unit_setting with the given name.
+$$;
+
+COMMIT;

-----------------------------------------------------------------------

Summary of changes:
 .../perlmods/lib/OpenILS/Application/AppUtils.pm   |    8 +++++++-
 Open-ILS/src/sql/Pg/002.schema.config.sql          |    2 +-
 Open-ILS/src/sql/Pg/020.schema.functions.sql       |    4 ++--
 Open-ILS/src/sql/Pg/live_t/aous_batch.pg           |    6 +++---
 ...a.make_ous_batch_retrieve_func_nonvariadic.sql} |    9 ++++++---
 5 files changed, 19 insertions(+), 10 deletions(-)
 copy Open-ILS/src/sql/Pg/upgrade/{0946.schema.batch_settings_retrieve_function.sql => 0978.schema.make_ous_batch_retrieve_func_nonvariadic.sql} (73%)


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list