[open-ils-commits] [GIT] Evergreen ILS branch rel_2_3 updated. acd15d1afc42e3c4ccfa140297543121b4eefc4f

Evergreen Git git at git.evergreen-ils.org
Wed Mar 20 16:58:36 EDT 2013


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_3 has been updated
       via  acd15d1afc42e3c4ccfa140297543121b4eefc4f (commit)
       via  2cd7d4866f5bc960b46a1486247fb1b3b40cee47 (commit)
      from  4f0b43e7b510710f8180a913271e987a4864cf66 (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 acd15d1afc42e3c4ccfa140297543121b4eefc4f
Author: Bill Erickson <berick at esilibrary.com>
Date:   Wed Mar 20 16:42:10 2013 -0400

    LP 1150458 DB upgrade stamping
    
    Signed-off-by: Bill Erickson <berick at esilibrary.com>

diff --git a/Open-ILS/src/sql/Pg/002.schema.config.sql b/Open-ILS/src/sql/Pg/002.schema.config.sql
index 764c4f6..45a0b50 100644
--- a/Open-ILS/src/sql/Pg/002.schema.config.sql
+++ b/Open-ILS/src/sql/Pg/002.schema.config.sql
@@ -87,7 +87,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 ('0783', :eg_version); -- gmcharlt/dbs
+INSERT INTO config.upgrade_log (version, applied_to) VALUES ('0784', :eg_version); -- Callender/berick
 
 CREATE TABLE config.bib_source (
 	id		SERIAL	PRIMARY KEY,
diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.function.axis_authority_tags_refs_aggregate b/Open-ILS/src/sql/Pg/upgrade/0784.schema.axis_authority_tags_refs_aggregate.sql
similarity index 95%
rename from Open-ILS/src/sql/Pg/upgrade/XXXX.function.axis_authority_tags_refs_aggregate
rename to Open-ILS/src/sql/Pg/upgrade/0784.schema.axis_authority_tags_refs_aggregate.sql
index 5a2dcc9..512078a 100644
--- a/Open-ILS/src/sql/Pg/upgrade/XXXX.function.axis_authority_tags_refs_aggregate
+++ b/Open-ILS/src/sql/Pg/upgrade/0784.schema.axis_authority_tags_refs_aggregate.sql
@@ -3,7 +3,7 @@
 BEGIN;
 
 -- check whether patch can be applied
-SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version);
+SELECT evergreen.upgrade_deps_block_check('0784', :eg_version);
 
 CREATE OR REPLACE FUNCTION authority.axis_authority_tags_refs(a TEXT) RETURNS INT[] AS $$
     SELECT ARRAY_AGG(y) from (

commit 2cd7d4866f5bc960b46a1486247fb1b3b40cee47
Author: Steven Callender <stevecallender at esilibrary.com>
Date:   Thu Mar 7 09:28:08 2013 -0500

    Changed the way authority tags were being pulled to specifically use an aggregate array.
    
    There appears to have been a change in postgres at some point between 9.0 and 9.1
    to the aggregate method. Because of this, postgres was not returning the proper
    results when pulling tags for authorities. This change will force postgres to do
    a proper aggregate array call and return the correct results.
    
    Signed-off-by: Steven Callender <stevecallender at esilibrary.com>
    Signed-off-by: Bill Erickson <berick at esilibrary.com>

diff --git a/Open-ILS/src/sql/Pg/011.schema.authority.sql b/Open-ILS/src/sql/Pg/011.schema.authority.sql
index 10ac1d6..2e4f14a 100644
--- a/Open-ILS/src/sql/Pg/011.schema.authority.sql
+++ b/Open-ILS/src/sql/Pg/011.schema.authority.sql
@@ -608,47 +608,49 @@ CREATE OR REPLACE FUNCTION authority.axis_authority_tags(a TEXT) RETURNS INT[] A
     SELECT ARRAY_ACCUM(field) FROM authority.browse_axis_authority_field_map WHERE axis = $1;
 $$ LANGUAGE SQL;
 
+
 CREATE OR REPLACE FUNCTION authority.axis_authority_tags_refs(a TEXT) RETURNS INT[] AS $$
-    SELECT  ARRAY_CAT(
-                ARRAY[a.field],
-                (SELECT ARRAY_ACCUM(x.id) FROM authority.control_set_authority_field x WHERE x.main_entry = a.field)
-            )
-      FROM  authority.browse_axis_authority_field_map a
-      WHERE axis = $1
+    SELECT ARRAY_AGG(y) from (
+       SELECT  unnest(ARRAY_CAT(
+                 ARRAY[a.field],
+                 (SELECT ARRAY_ACCUM(x.id) FROM authority.control_set_authority_field x WHERE x.main_entry = a.field)
+             )) y
+       FROM  authority.browse_axis_authority_field_map a
+       WHERE axis = $1) x
 $$ LANGUAGE SQL;
 
 
-
 CREATE OR REPLACE FUNCTION authority.btag_authority_tags(btag TEXT) RETURNS INT[] AS $$
     SELECT ARRAY_ACCUM(authority_field) FROM authority.control_set_bib_field WHERE tag = $1
 $$ LANGUAGE SQL;
 
+
 CREATE OR REPLACE FUNCTION authority.btag_authority_tags_refs(btag TEXT) RETURNS INT[] AS $$
-    SELECT  ARRAY_CAT(
-                ARRAY[a.authority_field],
-                (SELECT ARRAY_ACCUM(x.id) FROM authority.control_set_authority_field x WHERE x.main_entry = a.authority_field)
-            )
+    SELECT ARRAY_AGG(y) from (
+        SELECT  unnest(ARRAY_CAT(
+                    ARRAY[a.authority_field],
+                    (SELECT ARRAY_ACCUM(x.id) FROM authority.control_set_authority_field x WHERE x.main_entry = a.authority_field)
+                )) y
       FROM  authority.control_set_bib_field a
-      WHERE a.tag = $1
+      WHERE a.tag = $1) x
 $$ LANGUAGE SQL;
 
 
-
 CREATE OR REPLACE FUNCTION authority.atag_authority_tags(atag TEXT) RETURNS INT[] AS $$
     SELECT ARRAY_ACCUM(id) FROM authority.control_set_authority_field WHERE tag = $1
 $$ LANGUAGE SQL;
 
 CREATE OR REPLACE FUNCTION authority.atag_authority_tags_refs(atag TEXT) RETURNS INT[] AS $$
-    SELECT  ARRAY_CAT(
-                ARRAY[a.id],
-                (SELECT ARRAY_ACCUM(x.id) FROM authority.control_set_authority_field x WHERE x.main_entry = a.id)
-            )
+    SELECT ARRAY_AGG(y) from (
+        SELECT  unnest(ARRAY_CAT(
+                    ARRAY[a.id],
+                    (SELECT ARRAY_ACCUM(x.id) FROM authority.control_set_authority_field x WHERE x.main_entry = a.id)
+                )) y
       FROM  authority.control_set_authority_field a
-      WHERE a.tag = $1
+      WHERE a.tag = $1) x
 $$ LANGUAGE SQL;
 
 
-
 CREATE OR REPLACE FUNCTION authority.axis_browse_center( a TEXT, q TEXT, page INT DEFAULT 0, pagesize INT DEFAULT 9 ) RETURNS SETOF BIGINT AS $$
     SELECT * FROM authority.simple_heading_browse_center(authority.axis_authority_tags($1), $2, $3, $4)
 $$ LANGUAGE SQL ROWS 10;
diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.function.axis_authority_tags_refs_aggregate b/Open-ILS/src/sql/Pg/upgrade/XXXX.function.axis_authority_tags_refs_aggregate
new file mode 100644
index 0000000..5a2dcc9
--- /dev/null
+++ b/Open-ILS/src/sql/Pg/upgrade/XXXX.function.axis_authority_tags_refs_aggregate
@@ -0,0 +1,39 @@
+-- Evergreen DB patch XXXX.function.axis_authority_tags_refs_aggregate.sql
+--
+BEGIN;
+
+-- check whether patch can be applied
+SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version);
+
+CREATE OR REPLACE FUNCTION authority.axis_authority_tags_refs(a TEXT) RETURNS INT[] AS $$
+    SELECT ARRAY_AGG(y) from (
+       SELECT  unnest(ARRAY_CAT(
+                 ARRAY[a.field],
+                 (SELECT ARRAY_ACCUM(x.id) FROM authority.control_set_authority_field x WHERE x.main_entry = a.field)
+             )) y
+       FROM  authority.browse_axis_authority_field_map a
+       WHERE axis = $1) x;
+$$ LANGUAGE SQL;
+
+CREATE OR REPLACE FUNCTION authority.btag_authority_tags_refs(btag TEXT) RETURNS INT[] AS $$
+    SELECT ARRAY_AGG(y) from (
+        SELECT  unnest(ARRAY_CAT(
+                    ARRAY[a.authority_field],
+                    (SELECT ARRAY_ACCUM(x.id) FROM authority.control_set_authority_field x WHERE x.main_entry = a.authority_field)
+                )) y
+      FROM  authority.control_set_bib_field a
+      WHERE a.tag = $1) x
+$$ LANGUAGE SQL;
+
+CREATE OR REPLACE FUNCTION authority.atag_authority_tags_refs(atag TEXT) RETURNS INT[] AS $$
+    SELECT ARRAY_AGG(y) from (
+        SELECT  unnest(ARRAY_CAT(
+                    ARRAY[a.id],
+                    (SELECT ARRAY_ACCUM(x.id) FROM authority.control_set_authority_field x WHERE x.main_entry = a.id)
+                )) y
+      FROM  authority.control_set_authority_field a
+      WHERE a.tag = $1) x
+$$ LANGUAGE SQL;
+
+
+COMMIT;

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

Summary of changes:
 Open-ILS/src/sql/Pg/002.schema.config.sql          |    2 +-
 Open-ILS/src/sql/Pg/011.schema.authority.sql       |   40 ++++++++++---------
 ...4.schema.axis_authority_tags_refs_aggregate.sql |   39 +++++++++++++++++++
 3 files changed, 61 insertions(+), 20 deletions(-)
 create mode 100644 Open-ILS/src/sql/Pg/upgrade/0784.schema.axis_authority_tags_refs_aggregate.sql


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list