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

Commit 8776c15

Browse files
committed
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.
1 parent aa09cd2 commit 8776c15

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/backend/optimizer/plan/createplan.c

+8-2
Original file line numberDiff line numberDiff line change
@@ -1360,11 +1360,17 @@ create_gather_plan(PlannerInfo *root, GatherPath *best_path)
13601360
{
13611361
Gather *gather_plan;
13621362
Plan *subplan;
1363+
List *tlist;
13631364

1364-
/* Must insist that all children return the same tlist */
1365+
/*
1366+
* Although the Gather node can project, we prefer to push down such work
1367+
* to its child node, so demand an exact tlist from the child.
1368+
*/
13651369
subplan = create_plan_recurse(root, best_path->subpath, CP_EXACT_TLIST);
13661370

1367-
gather_plan = make_gather(subplan->targetlist,
1371+
tlist = build_path_tlist(root, &best_path->path);
1372+
1373+
gather_plan = make_gather(tlist,
13681374
NIL,
13691375
best_path->path.parallel_degree,
13701376
best_path->single_copy,

0 commit comments

Comments
 (0)