]> granicus.if.org Git - postgresql/commit
Fix PlaceHolderVar mechanism's interaction with outer joins.
authorTom Lane <tgl@sss.pgh.pa.us>
Tue, 28 Sep 2010 16:08:56 +0000 (12:08 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Tue, 28 Sep 2010 18:19:00 +0000 (14:19 -0400)
commiteb229505103eb5494c33832d422584bfdee03fc6
treeca7c12732d170cb5abef8f108b2d95f508444b7c
parent9c5f4f6cb50dd22028acc0b6f20291a5edcac62b
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.
src/backend/nodes/copyfuncs.c
src/backend/nodes/equalfuncs.c
src/backend/nodes/outfuncs.c
src/backend/optimizer/plan/analyzejoins.c
src/backend/optimizer/plan/initsplan.c
src/backend/optimizer/plan/planmain.c
src/backend/optimizer/util/placeholder.c
src/include/nodes/relation.h
src/include/optimizer/placeholder.h
src/test/regress/expected/join.out
src/test/regress/sql/join.sql