From 81e41ebf0db1d3f655b2806f4f8e4e31d9361229 Mon Sep 17 00:00:00 2001 From: Dan Scott Date: Mon, 21 May 2012 14:46:53 -0400 Subject: [PATCH] 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 --- .../perlmods/lib/OpenILS/Application/Storage/Driver/Pg/QueryParser.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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"; -- 2.11.0