pgsql: Fix PlaceHolderVar mechanism's interaction with outer joins.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Fix PlaceHolderVar mechanism's interaction with outer joins.
Date: 2010-09-28 18:21:27
Message-ID: E1P0env-0008HZ-OR@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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.

Branch
------
REL8_4_STABLE

Details
-------
http://git.postgresql.org/gitweb?p=postgresql.git;a=commitdiff;h=dc9cc887b74bfa0d40829c4df66dead509fdd8f6

Modified Files
--------------
src/backend/nodes/copyfuncs.c | 1 +
src/backend/nodes/equalfuncs.c | 1 +
src/backend/nodes/outfuncs.c | 1 +
src/backend/optimizer/plan/initsplan.c | 37 +++++
src/backend/optimizer/plan/planmain.c | 21 ++-
src/backend/optimizer/util/placeholder.c | 234 +++++++++++++++++++++++++++---
src/include/nodes/relation.h | 17 ++-
src/include/optimizer/placeholder.h | 5 +-
src/test/regress/expected/join.out | 45 ++++++
src/test/regress/sql/join.sql | 40 +++++
10 files changed, 369 insertions(+), 33 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Bruce Momjian 2010-09-28 18:32:11 pgsql: Mention in pg_upgrade docs that the proper Win32 service name sh
Previous Message Bruce Momjian 2010-09-28 17:25:27 pgsql: Add mention of installing pg_upgrade_support in pg_upgrade doc s