[open-ils-commits] r20295 - in trunk/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage: . Driver/Pg (miker)

svn at svn.open-ils.org svn at svn.open-ils.org
Fri Apr 22 17:35:02 EDT 2011


Author: miker
Date: 2011-04-22 17:34:56 -0400 (Fri, 22 Apr 2011)
New Revision: 20295

Modified:
   trunk/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Driver/Pg/QueryParser.pm
   trunk/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/QueryParser.pm
Log:
address the empty-query case

Modified: trunk/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Driver/Pg/QueryParser.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Driver/Pg/QueryParser.pm	2011-04-22 21:13:39 UTC (rev 20294)
+++ trunk/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Driver/Pg/QueryParser.pm	2011-04-22 21:34:56 UTC (rev 20295)
@@ -585,6 +585,13 @@
 
     my $core_limit = $self->QueryParser->core_limit || 25000;
 
+    my $flat_where = $$flat_plan{where};
+    if ($flat_where eq '()') {
+        $flat_where = '';
+    } else {
+        $flat_where = "AND $flat_where";
+    }
+
     my $sql = <<SQL;
 SELECT  $key AS id,
         ARRAY_ACCUM(DISTINCT m.source) AS records,
@@ -600,7 +607,7 @@
         $during
         $between
         $combined_dyn_filters
-        AND $$flat_plan{where}
+        $flat_where
   GROUP BY 1
   ORDER BY 4 $desc NULLS LAST, 5 DESC NULLS LAST, 3 DESC
   LIMIT $core_limit

Modified: trunk/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/QueryParser.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/QueryParser.pm	2011-04-22 21:13:39 UTC (rev 20294)
+++ trunk/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/QueryParser.pm	2011-04-22 21:34:56 UTC (rev 20295)
@@ -685,7 +685,7 @@
 
     }
 
-    $struct = undef if (scalar(@{$struct->query_nodes}) == 0);
+    $struct = undef if (scalar(@{$struct->query_nodes}) == 0 && !$struct->top_plan);
 
     return $struct if !wantarray;
     return ($struct, $remainder);



More information about the open-ils-commits mailing list