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=7abdb32ecbfecc3f01016c64b8f3f8faff45a93e;p=evergreen%2Fmasslnc.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 Signed-off-by: Bill Erickson --- 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 f833a6bd86..144ee5595c 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";