Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit c37ecaf

Browse files
committed
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)
1 parent 878d952 commit c37ecaf

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/backend/optimizer/prep/prepunion.c

+8-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/optimizer/prep/prepunion.c,v 1.32 1999/06/06 17:38:11 tgl Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/optimizer/prep/prepunion.c,v 1.33 1999/06/10 06:55:40 tgl Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -192,6 +192,13 @@ plan_union_queries(Query *parse)
192192
/* needed so we don't take the flag from the first query */
193193
parse->uniqueFlag = NULL;
194194

195+
/* Make sure we don't try to apply the first query's grouping stuff
196+
* to the Append node, either. Basically we don't want union_planner
197+
* to do anything when we return control, except add the top sort/unique
198+
* nodes for DISTINCT processing if this wasn't UNION ALL, or the top
199+
* sort node if it was UNION ALL with a user-provided sort clause.
200+
*/
201+
parse->groupClause = NULL;
195202
parse->havingQual = NULL;
196203
parse->hasAggs = false;
197204

0 commit comments

Comments
 (0)