aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>1999-06-10 06:55:40 +0000
committerTom Lane <tgl@sss.pgh.pa.us>1999-06-10 06:55:40 +0000
commitc37ecaf8d558d4e6415417adba7191934202e1d2 (patch)
tree07f56f9b83bfc67261e01cd7869446d1fb102dbd
parent878d9520843e5eb622f115e612a6e0504aa8deaa (diff)
downloadpostgresql-c37ecaf8d558d4e6415417adba7191934202e1d2.tar.gz
postgresql-c37ecaf8d558d4e6415417adba7191934202e1d2.zip
Fix errors in SELECT ... GROUP BY ... UNION SELECT ...
ye proverbial one-line patch (not counting five lines of comment so's maybe it won't happen again)
-rw-r--r--src/backend/optimizer/prep/prepunion.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/backend/optimizer/prep/prepunion.c b/src/backend/optimizer/prep/prepunion.c
index 478186b631b..9ae2fb57a89 100644
--- a/src/backend/optimizer/prep/prepunion.c
+++ b/src/backend/optimizer/prep/prepunion.c
@@ -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;