LP#1489955: tweak to work on PostgreSQL 9.1
authorGalen Charlton <gmc@esilibrary.com>
Mon, 14 Sep 2015 15:34:47 +0000 (15:34 +0000)
committerJason Stephenson <jstephenson@mvlc.org>
Mon, 14 Sep 2015 19:44:22 +0000 (15:44 -0400)
Stored functions written in SQL cannot use parameter
names in their bodies until Pg 9.2.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Jason Stephenson <jstephenson@mvlc.org>
Open-ILS/src/sql/Pg/011.schema.authority.sql
Open-ILS/src/sql/Pg/upgrade/XXXX.schema.filter_authority_browse_search_by_thesaurus.sql

index 014b731..8322867 100644 (file)
@@ -884,9 +884,9 @@ CREATE OR REPLACE FUNCTION authority.simple_heading_search_rank( atag_list INT[]
             plainto_tsquery('keyword'::regconfig,$2) ptsq(term)
       WHERE ash.atag = ANY ($1)
             AND ash.index_vector @@ ptsq.term
-            AND CASE thesauruses
+            AND CASE $5
                 WHEN '' THEN TRUE
-                ELSE ash.thesaurus = ANY(regexp_split_to_array(thesauruses, ','))
+                ELSE ash.thesaurus = ANY(regexp_split_to_array($5, ','))
                 END
       ORDER BY ts_rank_cd(ash.index_vector,ptsq.term,14)::numeric
                     + CASE WHEN ash.sort_value LIKE t.term || '%' THEN 2 ELSE 0 END
@@ -927,9 +927,9 @@ CREATE OR REPLACE FUNCTION authority.simple_heading_search_heading( atag_list IN
             plainto_tsquery('keyword'::regconfig,$2) ptsq(term)
       WHERE ash.atag = ANY ($1)
             AND ash.index_vector @@ ptsq.term
-            AND CASE thesauruses
+            AND CASE $5
                 WHEN '' THEN TRUE
-                ELSE ash.thesaurus = ANY(regexp_split_to_array(thesauruses, ','))
+                ELSE ash.thesaurus = ANY(regexp_split_to_array($5, ','))
                 END
       ORDER BY ash.sort_value
       LIMIT $4
index b9084ec..b7f2be6 100644 (file)
@@ -514,9 +514,9 @@ CREATE OR REPLACE FUNCTION authority.simple_heading_search_rank( atag_list INT[]
             plainto_tsquery('keyword'::regconfig,$2) ptsq(term)
       WHERE ash.atag = ANY ($1)
             AND ash.index_vector @@ ptsq.term
-            AND CASE thesauruses
+            AND CASE $5
                 WHEN '' THEN TRUE
-                ELSE ash.thesaurus = ANY(regexp_split_to_array(thesauruses, ','))
+                ELSE ash.thesaurus = ANY(regexp_split_to_array($5, ','))
                 END
       ORDER BY ts_rank_cd(ash.index_vector,ptsq.term,14)::numeric
                     + CASE WHEN ash.sort_value LIKE t.term || '%' THEN 2 ELSE 0 END
@@ -557,9 +557,9 @@ CREATE OR REPLACE FUNCTION authority.simple_heading_search_heading( atag_list IN
             plainto_tsquery('keyword'::regconfig,$2) ptsq(term)
       WHERE ash.atag = ANY ($1)
             AND ash.index_vector @@ ptsq.term
-            AND CASE thesauruses
+            AND CASE $5
                 WHEN '' THEN TRUE
-                ELSE ash.thesaurus = ANY(regexp_split_to_array(thesauruses, ','))
+                ELSE ash.thesaurus = ANY(regexp_split_to_array($5, ','))
                 END
       ORDER BY ash.sort_value
       LIMIT $4