summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMason Sharp2015-03-03 02:39:47 +0000
committerPavan Deolasee2015-04-15 05:49:16 +0000
commit94621acc059884c8accc108ef7becfc96e363a6e (patch)
tree5ebfda2e08bb03773eed274e814735dc1423f3dd /src
parentbc48c6d1188f84c41a70763cbfa5bfeaf40bf3ad (diff)
In make_remotesubplan, there could be make new result node if
is_projection_capable_plan is false in the case of merge sort. If so, the wrong lefttree and targetlist will be referenced. Patch by Jaimin Pan
Diffstat (limited to 'src')
-rw-r--r--src/backend/optimizer/plan/createplan.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/backend/optimizer/plan/createplan.c b/src/backend/optimizer/plan/createplan.c
index 783b8015d1..bc9cca3b69 100644
--- a/src/backend/optimizer/plan/createplan.c
+++ b/src/backend/optimizer/plan/createplan.c
@@ -4720,10 +4720,7 @@ make_remotesubplan(PlannerInfo *root,
node->distributionKey = InvalidAttrNumber;
node->distributionNodes = NIL;
}
- plan->qual = NIL;
- plan->lefttree = lefttree;
- plan->righttree = NULL;
- copy_plan_costsize(plan, lefttree);
+
/* determine where subplan will be executed */
if (execDistribution)
{
@@ -4768,7 +4765,7 @@ make_remotesubplan(PlannerInfo *root,
}
bms_free(tmpset);
}
- plan->targetlist = lefttree->targetlist;
+
/* We do not need to merge sort if only one node is yielding tuples */
if (pathkeys && node->execOnAll && list_length(node->nodeList) > 1)
{
@@ -4952,6 +4949,13 @@ make_remotesubplan(PlannerInfo *root,
node->sort->sortCollations = collations;
node->sort->nullsFirst = nullsFirst;
}
+
+ plan->qual = NIL;
+ plan->targetlist = lefttree->targetlist;
+ plan->lefttree = lefttree;
+ plan->righttree = NULL;
+ copy_plan_costsize(plan, lefttree);
+
node->cursor = get_internal_cursor();
node->unique = 0;
return node;