aboutsummaryrefslogtreecommitdiff
path: root/src/backend/optimizer/plan/analyzejoins.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2010-09-28 12:08:56 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2010-09-28 14:19:00 -0400
commiteb229505103eb5494c33832d422584bfdee03fc6 (patch)
treeca7c12732d170cb5abef8f108b2d95f508444b7c /src/backend/optimizer/plan/analyzejoins.c
parent9c5f4f6cb50dd22028acc0b6f20291a5edcac62b (diff)
downloadpostgresql-eb229505103eb5494c33832d422584bfdee03fc6.tar.gz
postgresql-eb229505103eb5494c33832d422584bfdee03fc6.zip
Fix PlaceHolderVar mechanism's interaction with outer joins.
The point of a PlaceHolderVar is to allow a non-strict expression to be evaluated below an outer join, after which its value bubbles up like a Var and can be forced to NULL when the outer join's semantics require that. However, there was a serious design oversight in that, namely that we didn't ensure that there was actually a correct place in the plan tree to evaluate the placeholder :-(. It may be necessary to delay evaluation of an outer join to ensure that a placeholder that should be evaluated below the join can be evaluated there. Per recent bug report from Kirill Simonov. Back-patch to 8.4 where the PlaceHolderVar mechanism was introduced.
Diffstat (limited to 'src/backend/optimizer/plan/analyzejoins.c')
-rw-r--r--src/backend/optimizer/plan/analyzejoins.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/backend/optimizer/plan/analyzejoins.c b/src/backend/optimizer/plan/analyzejoins.c
index 2a913578eba..89805c36b06 100644
--- a/src/backend/optimizer/plan/analyzejoins.c
+++ b/src/backend/optimizer/plan/analyzejoins.c
@@ -396,6 +396,8 @@ remove_rel_from_query(PlannerInfo *root, int relid, Relids joinrelids)
phinfo->ph_eval_at = bms_add_member(phinfo->ph_eval_at, relid);
phinfo->ph_needed = bms_del_member(phinfo->ph_needed, relid);
+ /* ph_may_need probably isn't used after this, but fix it anyway */
+ phinfo->ph_may_need = bms_del_member(phinfo->ph_may_need, relid);
}
/*