Commit 8776c15c authored by Tom Lane's avatar Tom Lane

Fix incorrect tlist generation in create_gather_plan().

This function is written as though Gather doesn't project; but it does.
Even if it did not project, though, we must use build_path_tlist to ensure
that the output columns receive correct sortgroupref labeling.

Per report from Amit Kapila.
parent aa09cd24
...@@ -1360,11 +1360,17 @@ create_gather_plan(PlannerInfo *root, GatherPath *best_path) ...@@ -1360,11 +1360,17 @@ create_gather_plan(PlannerInfo *root, GatherPath *best_path)
{ {
Gather *gather_plan; Gather *gather_plan;
Plan *subplan; Plan *subplan;
List *tlist;
/* Must insist that all children return the same tlist */ /*
* Although the Gather node can project, we prefer to push down such work
* to its child node, so demand an exact tlist from the child.
*/
subplan = create_plan_recurse(root, best_path->subpath, CP_EXACT_TLIST); subplan = create_plan_recurse(root, best_path->subpath, CP_EXACT_TLIST);
gather_plan = make_gather(subplan->targetlist, tlist = build_path_tlist(root, &best_path->path);
gather_plan = make_gather(tlist,
NIL, NIL,
best_path->path.parallel_degree, best_path->path.parallel_degree,
best_path->single_copy, best_path->single_copy,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment