[open-ils-commits] ***SPAM*** [GIT] Evergreen ILS branch master updated. 978b099d5d36c50c27fbae0ffff027047e81c3c6
Evergreen Git
git at git.evergreen-ils.org
Wed Dec 10 16:04:55 EST 2014
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, master has been updated
via 978b099d5d36c50c27fbae0ffff027047e81c3c6 (commit)
via 55cc3fa36c1832743e1c54c1e20d03982f00409d (commit)
from d7e1c5e5389db5b6bc3e4d25ef9942d78a76902c (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 978b099d5d36c50c27fbae0ffff027047e81c3c6
Author: Jason Stephenson <jstephenson at mvlc.org>
Date: Wed Dec 10 16:03:11 2014 -0500
LP#1401177: Stamping upgrade script of unique_mr_attrs.sql.
Signed-off-by: Jason Stephenson <jstephenson at mvlc.org>
diff --git a/Open-ILS/src/sql/Pg/002.schema.config.sql b/Open-ILS/src/sql/Pg/002.schema.config.sql
index c097449..e674182 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 ('0897', :eg_version); -- csharp/miker/bshum
+INSERT INTO config.upgrade_log (version, applied_to) VALUES ('0898', :eg_version); -- miker/Dyrcona
CREATE TABLE config.bib_source (
id SERIAL PRIMARY KEY,
diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.unique_mr_attrs.sql b/Open-ILS/src/sql/Pg/upgrade/0898.unique_mr_attrs.sql
similarity index 98%
rename from Open-ILS/src/sql/Pg/upgrade/XXXX.unique_mr_attrs.sql
rename to Open-ILS/src/sql/Pg/upgrade/0898.unique_mr_attrs.sql
index 00a549b..1320f9b 100644
--- a/Open-ILS/src/sql/Pg/upgrade/XXXX.unique_mr_attrs.sql
+++ b/Open-ILS/src/sql/Pg/upgrade/0898.unique_mr_attrs.sql
@@ -1,6 +1,6 @@
BEGIN;
-SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version);
+SELECT evergreen.upgrade_deps_block_check('0898', :eg_version);
CREATE OR REPLACE FUNCTION unapi.mmr_mra (
obj_id BIGINT,
commit 55cc3fa36c1832743e1c54c1e20d03982f00409d
Author: Mike Rylander <mrylander at gmail.com>
Date: Wed Dec 10 13:51:51 2014 -0500
LP#1401177: uniquify attrs across a metarecord
Signed-off-by: Mike Rylander <mrylander at gmail.com>
Signed-off-by: Jason Stephenson <jstephenson at mvlc.org>
diff --git a/Open-ILS/src/sql/Pg/990.schema.unapi.sql b/Open-ILS/src/sql/Pg/990.schema.unapi.sql
index 47b40e3..8ad2ec4 100644
--- a/Open-ILS/src/sql/Pg/990.schema.unapi.sql
+++ b/Open-ILS/src/sql/Pg/990.schema.unapi.sql
@@ -1283,20 +1283,20 @@ CREATE OR REPLACE FUNCTION unapi.mmr_mra (
),
(SELECT XMLAGG(foo.y)
FROM (
- WITH sourcelist AS (
- WITH aou AS (SELECT COALESCE(id, (evergreen.org_top()).id) AS id
+ WITH sourcelist AS (
+ WITH aou AS (SELECT COALESCE(id, (evergreen.org_top()).id) AS id
FROM actor.org_unit WHERE shortname = $5 LIMIT 1)
- SELECT source
- FROM metabib.metarecord_source_map, aou
+ SELECT source
+ FROM metabib.metarecord_source_map, aou
WHERE metarecord = $1 AND (
EXISTS (
- SELECT 1 FROM asset.opac_visible_copies
+ SELECT 1 FROM asset.opac_visible_copies
WHERE record = source AND circ_lib IN (
SELECT id FROM actor.org_unit_descendants(aou.id, $6))
LIMIT 1
- )
+ )
OR EXISTS (SELECT 1 FROM located_uris(source, aou.id, $10) LIMIT 1)
- )
+ )
)
SELECT cmra.aid,
XMLELEMENT(
@@ -1313,15 +1313,18 @@ CREATE OR REPLACE FUNCTION unapi.mmr_mra (
cmra.value
)
FROM (
- SELECT v.source AS id,
- c.id AS aid,
- c.ctype AS attr,
- c.code AS value
- FROM metabib.record_attr_vector_list v
- JOIN config.coded_value_map c ON ( c.id = ANY( v.vlist ) )
+ SELECT DISTINCT aid, attr, value
+ FROM (
+ SELECT v.source AS id,
+ c.id AS aid,
+ c.ctype AS attr,
+ c.code AS value
+ FROM metabib.record_attr_vector_list v
+ JOIN config.coded_value_map c ON ( c.id = ANY( v.vlist ) )
+ ) AS x
+ JOIN sourcelist ON (x.id = sourcelist.source)
) AS cmra
- JOIN config.record_attr_definition rad ON (cmra.attr = rad.name)
- JOIN sourcelist ON (cmra.id = sourcelist.source)
+ JOIN config.record_attr_definition rad ON (cmra.attr = rad.name)
UNION ALL
SELECT umra.aid,
XMLELEMENT(
@@ -1336,15 +1339,18 @@ CREATE OR REPLACE FUNCTION unapi.mmr_mra (
umra.value
)
FROM (
- SELECT v.source AS id,
- m.id AS aid,
- m.attr AS attr,
- m.value AS value
- FROM metabib.record_attr_vector_list v
- JOIN metabib.uncontrolled_record_attr_value m ON ( m.id = ANY( v.vlist ) )
+ SELECT DISTINCT aid, attr, value
+ FROM (
+ SELECT v.source AS id,
+ m.id AS aid,
+ m.attr AS attr,
+ m.value AS value
+ FROM metabib.record_attr_vector_list v
+ JOIN metabib.uncontrolled_record_attr_value m ON ( m.id = ANY( v.vlist ) )
+ ) AS x
+ JOIN sourcelist ON (x.id = sourcelist.source)
) AS umra
- JOIN config.record_attr_definition rad ON (umra.attr = rad.name)
- JOIN sourcelist ON (umra.id = sourcelist.source)
+ JOIN config.record_attr_definition rad ON (umra.attr = rad.name)
ORDER BY 1
)foo(id,y)
diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.unique_mr_attrs.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.unique_mr_attrs.sql
new file mode 100644
index 0000000..00a549b
--- /dev/null
+++ b/Open-ILS/src/sql/Pg/upgrade/XXXX.unique_mr_attrs.sql
@@ -0,0 +1,101 @@
+BEGIN;
+
+SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version);
+
+CREATE OR REPLACE FUNCTION unapi.mmr_mra (
+ obj_id BIGINT,
+ format TEXT,
+ ename TEXT,
+ includes TEXT[],
+ org TEXT,
+ depth INT DEFAULT NULL,
+ slimit HSTORE DEFAULT NULL,
+ soffset HSTORE DEFAULT NULL,
+ include_xmlns BOOL DEFAULT TRUE,
+ pref_lib INT DEFAULT NULL
+) RETURNS XML AS $F$
+ SELECT XMLELEMENT(
+ name attributes,
+ XMLATTRIBUTES(
+ CASE WHEN $9 THEN 'http://open-ils.org/spec/indexing/v1' ELSE NULL END AS xmlns,
+ 'tag:open-ils.org:U2 at mmr/' || $1 AS metarecord
+ ),
+ (SELECT XMLAGG(foo.y)
+ FROM (
+ WITH sourcelist AS (
+ WITH aou AS (SELECT COALESCE(id, (evergreen.org_top()).id) AS id
+ FROM actor.org_unit WHERE shortname = $5 LIMIT 1)
+ SELECT source
+ FROM metabib.metarecord_source_map, aou
+ WHERE metarecord = $1 AND (
+ EXISTS (
+ SELECT 1 FROM asset.opac_visible_copies
+ WHERE record = source AND circ_lib IN (
+ SELECT id FROM actor.org_unit_descendants(aou.id, $6))
+ LIMIT 1
+ )
+ OR EXISTS (SELECT 1 FROM located_uris(source, aou.id, $10) LIMIT 1)
+ )
+ )
+ SELECT cmra.aid,
+ XMLELEMENT(
+ name field,
+ XMLATTRIBUTES(
+ cmra.attr AS name,
+ cmra.value AS "coded-value",
+ cmra.aid AS "cvmid",
+ rad.composite,
+ rad.multi,
+ rad.filter,
+ rad.sorter
+ ),
+ cmra.value
+ )
+ FROM (
+ SELECT DISTINCT aid, attr, value
+ FROM (
+ SELECT v.source AS id,
+ c.id AS aid,
+ c.ctype AS attr,
+ c.code AS value
+ FROM metabib.record_attr_vector_list v
+ JOIN config.coded_value_map c ON ( c.id = ANY( v.vlist ) )
+ ) AS x
+ JOIN sourcelist ON (x.id = sourcelist.source)
+ ) AS cmra
+ JOIN config.record_attr_definition rad ON (cmra.attr = rad.name)
+ UNION ALL
+ SELECT umra.aid,
+ XMLELEMENT(
+ name field,
+ XMLATTRIBUTES(
+ umra.attr AS name,
+ rad.composite,
+ rad.multi,
+ rad.filter,
+ rad.sorter
+ ),
+ umra.value
+ )
+ FROM (
+ SELECT DISTINCT aid, attr, value
+ FROM (
+ SELECT v.source AS id,
+ m.id AS aid,
+ m.attr AS attr,
+ m.value AS value
+ FROM metabib.record_attr_vector_list v
+ JOIN metabib.uncontrolled_record_attr_value m ON ( m.id = ANY( v.vlist ) )
+ ) AS x
+ JOIN sourcelist ON (x.id = sourcelist.source)
+ ) AS umra
+ JOIN config.record_attr_definition rad ON (umra.attr = rad.name)
+ ORDER BY 1
+
+ )foo(id,y)
+ )
+ )
+$F$ LANGUAGE SQL STABLE;
+
+COMMIT;
+
-----------------------------------------------------------------------
Summary of changes:
Open-ILS/src/sql/Pg/002.schema.config.sql | 2 +-
Open-ILS/src/sql/Pg/990.schema.unapi.sql | 52 +++++++++++---------
...r_flat_speedup.sql => 0898.unique_mr_attrs.sql} | 53 +++++++++-----------
3 files changed, 53 insertions(+), 54 deletions(-)
copy Open-ILS/src/sql/Pg/upgrade/{0892.schema.record_attr_flat_speedup.sql => 0898.unique_mr_attrs.sql} (62%)
hooks/post-receive
--
Evergreen ILS
More information about the open-ils-commits
mailing list