From: Dan Scott Date: Mon, 21 May 2012 18:46:53 +0000 (-0400) Subject: QueryParser: comma-delimit multiple WITH clauses X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=81e41ebf0db1d3f655b2806f4f8e4e31d9361229;p=working%2FEvergreen.git QueryParser: comma-delimit multiple WITH clauses Bill Erickson's fix for my breakage of QueryParser.pm for the speedup via the WITH common table expression usage inadvertently left out the commas required to delimit multiple WITH clauses, resulting in SQL query errors. This fixes that oversight. Note that the fts-replacement.pl script came in quite handy for testing this; recommended. Signed-off-by: Dan Scott --- diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Driver/Pg/QueryParser.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Driver/Pg/QueryParser.pm index cc4d9147d7..3e9d10e838 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Driver/Pg/QueryParser.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Driver/Pg/QueryParser.pm @@ -746,8 +746,8 @@ sub flatten { $from .= "\n\t\t\tJOIN config.metabib_field AS fe_weight ON (fe_weight.id = fe.field)"; if ($node->dummy_count < @{$node->only_atoms} ) { - #$with.= "\n\t\t\tWITH ${talias}_xq AS (SELECT ". $node->tsquery ." AS tsq )"; - $with.= "${talias}_xq AS (SELECT ". $node->tsquery ." AS tsq )"; + $with .= ",\n" if $with; + $with .= "${talias}_xq AS (SELECT ". $node->tsquery ." AS tsq )"; $from .= "\n\t\t\tJOIN ${talias}_xq ON (fe.index_vector @@ ${talias}_xq.tsq)"; } else { $from .= "\n\t\t\t, (SELECT NULL::tsquery AS tsq ) AS x";