MemSet(&agg_counts, 0, sizeof(AggClauseCounts));
- /*
- * If the query involves ungrouped aggregation, then it can produce
- * at most one row, so we can ignore any ORDER BY or DISTINCT
- * request. This isn't all that exciting as an optimization, but it
- * prevents a corner case when optimize_minmax_aggregates succeeds:
- * if ORDER BY or DISTINCT were present we'd try, and fail, to match
- * the EquivalenceClasses we're about to build with the modified
- * targetlist entries it will create.
- */
- if (parse->hasAggs && parse->groupClause == NIL)
- {
- parse->sortClause = NIL;
- parse->distinctClause = NIL;
- }
-
/* Preprocess targetlist */
tlist = preprocess_targetlist(root, tlist);