index 644b8b6763d6aab7d94a59c6fb65f84be5a6faed..d8c5dd34d6a314a9d229b4dfceb20cf1c3aef82d 100644 (file)
&total_groups);
/*
- * Gather is always unsorted, so we'll need to sort, unless
- * there's no GROUP BY clause, in which case there will only be a
- * single group.
+ * Since Gather's output is always unsorted, we'll need to sort,
+ * unless there's no GROUP BY clause or a degenerate (constant)
+ * one, in which case there will only be a single group.
*/
- if (parse->groupClause)
+ if (root->group_pathkeys)
path = (Path *) create_sort_path(root,
grouped_rel,
path,