Corrected merge from trunk
authorMike Rylander <mrylander@gmail.com>
Tue, 12 Apr 2011 17:41:19 +0000 (13:41 -0400)
committerBill Erickson <berick@esilibrary.com>
Wed, 6 Jul 2011 18:50:48 +0000 (14:50 -0400)
Open-ILS/src/sql/Pg/000.functions.general.sql
Open-ILS/src/sql/Pg/012.schema.vandelay.sql

index 52301a4..40ab727 100644 (file)
@@ -15,6 +15,8 @@ $$ LANGUAGE plpgsql;
 
 SELECT evergreen.change_db_setting('search_path', ARRAY['evergreen','public','pg_catalog']);
 
+CREATE OR REPLACE FUNCTION evergreen.array_remove_item_by_value(inp ANYARRAY, el ANYELEMENT) RETURNS anyarray AS $$ SELECT ARRAY_ACCUM(x.e) FROM UNNEST( $1 ) x(e) WHERE x.e <> $2; $$ LANGUAGE SQL;
+
 CREATE OR REPLACE FUNCTION evergreen.lowercase( TEXT ) RETURNS TEXT AS $$
     return lc(shift);
 $$ LANGUAGE PLPERLU STRICT IMMUTABLE;
index a9506d1..7b4ba02 100644 (file)
@@ -2,8 +2,6 @@ DROP SCHEMA IF EXISTS vandelay CASCADE;
 
 BEGIN;
 
-CREATE OR REPLACE FUNCTION array_remove_item_by_value(inp ANYARRAY, el ANYELEMENT) RETURNS anyarray AS $$ SELECT ARRAY_ACCUM(x.e) FROM UNNEST( $1 ) x(e) WHERE x.e <> $2; $$ LANGUAGE SQL;
-
 CREATE SCHEMA vandelay;
 
 CREATE TABLE vandelay.match_set (
@@ -520,8 +518,8 @@ BEGIN
                 ELSIF test.required THEN
                     FOR tmp_rec IN SELECT * FROM UNNEST(matches) LOOP
                         IF tmp_rec NOT IN (SELECT * FROM UNNEST(potential_matches)) THEN
-                            matches := array_remove_item_by_value(matches, tmp_rec);
-                            potential_matches := array_remove_item_by_value(potential_matches, tmp_rec);
+                            matches := evergreen.array_remove_item_by_value(matches, tmp_rec);
+                            potential_matches := evergreen.array_remove_item_by_value(potential_matches, tmp_rec);
                         END IF;
                     END LOOP;
                 END IF;
@@ -542,8 +540,8 @@ BEGIN
             ELSIF test.required THEN
                 FOR tmp_rec IN SELECT * FROM UNNEST(matches) LOOP
                     IF tmp_rec NOT IN (SELECT * FROM UNNEST(potential_matches)) THEN
-                        matches := array_remove_item_by_value(matches, tmp_rec);
-                        potential_matches := array_remove_item_by_value(potential_matches, tmp_rec);
+                        matches := evergreen.array_remove_item_by_value(matches, tmp_rec);
+                        potential_matches := evergreen.array_remove_item_by_value(potential_matches, tmp_rec);
                     END IF;
                 END LOOP;
             END IF;