mirror of
https://github.com/postgres/postgres.git
synced 2025-05-05 09:19:17 +03:00
Fix partial aggregation for the case of a degenerate GROUP BY clause.
The plan generated for sorted partial aggregation with "GROUP BY constant" included a Sort node with no sort keys, which the executor does not like. Per report from Steve Randall. I'd add a regression test case if I could think of a compact one, but it doesn't seem worth expending lots of cycles on. Report: <CABVd52UAdGXpg_rCk46egpNKYdXOzCjuJ1zG26E2xBe_8bj+Fg@mail.gmail.com>
This commit is contained in:
parent
0b1b5033ac
commit
e1b449bea9
@ -3741,11 +3741,11 @@ create_grouping_paths(PlannerInfo *root,
|
|||||||
&total_groups);
|
&total_groups);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Gather is always unsorted, so we'll need to sort, unless
|
* Since Gather's output is always unsorted, we'll need to sort,
|
||||||
* there's no GROUP BY clause, in which case there will only be a
|
* unless there's no GROUP BY clause or a degenerate (constant)
|
||||||
* single group.
|
* one, in which case there will only be a single group.
|
||||||
*/
|
*/
|
||||||
if (parse->groupClause)
|
if (root->group_pathkeys)
|
||||||
path = (Path *) create_sort_path(root,
|
path = (Path *) create_sort_path(root,
|
||||||
grouped_rel,
|
grouped_rel,
|
||||||
path,
|
path,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user