From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | pgsql-committers(at)postgresql(dot)org |
Subject: | pgsql: Fix handling of PlaceHolderVars in nestloop parameter management |
Date: | 2011-11-03 04:51:25 |
Message-ID: | E1RLpGv-0005Jz-UH@gemulon.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers |
Fix handling of PlaceHolderVars in nestloop parameter management.
If we use a PlaceHolderVar from the outer relation in an inner indexscan,
we need to reference the PlaceHolderVar as such as the value to be passed
in from the outer relation. The previous code effectively tried to
reconstruct the PHV from its component expression, which doesn't work since
(a) the Vars therein aren't necessarily bubbled up far enough, and (b) it
would be the wrong semantics anyway because of the possibility that the PHV
is supposed to have gone to null at some point before the current join.
Point (a) led to "variable not found in subplan target list" planner
errors, but point (b) would have led to silently wrong answers.
Per report from Roger Niederland.
Branch
------
master
Details
-------
http://git.postgresql.org/pg/commitdiff/7e3bf99baa18524de6ef1492cb3057314da97e68
Modified Files
--------------
src/backend/executor/nodeNestloop.c | 1 +
src/backend/optimizer/plan/createplan.c | 71 ++++++++++++++++++++++++++++---
src/backend/optimizer/plan/setrefs.c | 4 ++
src/backend/optimizer/plan/subselect.c | 61 ++++++++++++++++++++++++++-
src/include/nodes/plannodes.h | 4 +-
src/include/nodes/relation.h | 21 +++++----
src/include/optimizer/subselect.h | 4 +-
src/test/regress/expected/join.out | 38 ++++++++++++++++
src/test/regress/sql/join.sql | 23 ++++++++++
9 files changed, 208 insertions(+), 19 deletions(-)
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2011-11-03 04:51:26 | pgsql: Fix handling of PlaceHolderVars in nestloop parameter management |
Previous Message | Tom Lane | 2011-11-03 03:16:09 | Re: Re: [COMMITTERS] pgsql: Reduce checkpoints and WAL traffic on low activity database serv |