diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2016-03-09 10:56:36 -0500 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2016-03-09 10:56:46 -0500 |
commit | 8776c15c85322612b9bf79daf50f74be71c12e05 (patch) | |
tree | e24a6caddd1c4327e1798f8f3ad0d8396268e178 /src/backend/optimizer/plan/createplan.c | |
parent | aa09cd242fa7e3a694a31f8aed521e80d1e626a4 (diff) | |
download | postgresql-8776c15c85322612b9bf79daf50f74be71c12e05.tar.gz postgresql-8776c15c85322612b9bf79daf50f74be71c12e05.zip |
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.
Diffstat (limited to 'src/backend/optimizer/plan/createplan.c')
-rw-r--r-- | src/backend/optimizer/plan/createplan.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/backend/optimizer/plan/createplan.c b/src/backend/optimizer/plan/createplan.c index 0c2d593499d..5c06547931b 100644 --- a/src/backend/optimizer/plan/createplan.c +++ b/src/backend/optimizer/plan/createplan.c @@ -1360,11 +1360,17 @@ create_gather_plan(PlannerInfo *root, GatherPath *best_path) { Gather *gather_plan; 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); - gather_plan = make_gather(subplan->targetlist, + tlist = build_path_tlist(root, &best_path->path); + + gather_plan = make_gather(tlist, NIL, best_path->path.parallel_degree, best_path->single_copy, |