]> granicus.if.org Git - postgresql/commitdiff
Fix errors in SELECT ... GROUP BY ... UNION SELECT ...
authorTom Lane <tgl@sss.pgh.pa.us>
Thu, 10 Jun 1999 06:55:40 +0000 (06:55 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Thu, 10 Jun 1999 06:55:40 +0000 (06:55 +0000)
ye proverbial one-line patch (not counting five lines of comment so's
maybe it won't happen again)

src/backend/optimizer/prep/prepunion.c

index 478186b631bdd84de393a099420d83709f6ea859..9ae2fb57a8915822abe47196a1535e637b076bac 100644 (file)
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/optimizer/prep/prepunion.c,v 1.32 1999/06/06 17:38:11 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/optimizer/prep/prepunion.c,v 1.33 1999/06/10 06:55:40 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -192,6 +192,13 @@ plan_union_queries(Query *parse)
                /* needed so we don't take the flag from the first query */
                parse->uniqueFlag = NULL;
 
+       /* Make sure we don't try to apply the first query's grouping stuff
+        * to the Append node, either.  Basically we don't want union_planner
+        * to do anything when we return control, except add the top sort/unique
+        * nodes for DISTINCT processing if this wasn't UNION ALL, or the top
+        * sort node if it was UNION ALL with a user-provided sort clause.
+        */
+       parse->groupClause = NULL;
        parse->havingQual = NULL;
        parse->hasAggs = false;