summaryrefslogtreecommitdiff
path: root/src/backend/optimizer/plan/planmain.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2011-11-08 21:14:21 -0500
committerTom Lane <tgl@sss.pgh.pa.us>2011-11-08 21:14:21 -0500
commit57664ed25e5dea117158a2e663c29e60b3546e1c (patch)
treefa7d1fb4b6fae1fa81452ac7bb1f58042b26c9c9 /src/backend/optimizer/plan/planmain.c
parent3b8161723c645853021b57330dd2ea0484ec6131 (diff)
downloadpostgresql-57664ed25e5dea117158a2e663c29e60b3546e1c.tar.gz
Wrap appendrel member outputs in PlaceHolderVars in additional cases.
Add PlaceHolderVar wrappers as needed to make UNION ALL sub-select output expressions appear non-constant and distinct from each other. This makes the world safe for add_child_rel_equivalences to do what it does. Before, it was possible for that function to add identical expressions to different EquivalenceClasses, which logically should imply merging such ECs, which would be wrong; or to improperly add a constant to an EquivalenceClass, drastically changing its behavior. Per report from Teodor Sigaev. The only currently known consequence of this bug is "MergeAppend child's targetlist doesn't match MergeAppend" planner failures in 9.1 and later. I am suspicious that there may be other failure modes that could affect older release branches; but in the absence of any hard evidence, I'll refrain from back-patching further than 9.1.
Diffstat (limited to 'src/backend/optimizer/plan/planmain.c')
-rw-r--r--src/backend/optimizer/plan/planmain.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/backend/optimizer/plan/planmain.c b/src/backend/optimizer/plan/planmain.c
index 55311058e5..4c076722de 100644
--- a/src/backend/optimizer/plan/planmain.c
+++ b/src/backend/optimizer/plan/planmain.c
@@ -176,7 +176,7 @@ query_planner(PlannerInfo *root, List *tlist,
*/
build_base_rel_tlists(root, tlist);
- find_placeholders_in_jointree(root);
+ find_placeholders_in_query(root);
joinlist = deconstruct_jointree(root);