pgsql: Fix handling of PlaceHolderVars in nestloop parameter management

Поиск
Список
Период
Сортировка
От Tom Lane
Тема pgsql: Fix handling of PlaceHolderVars in nestloop parameter management
Дата
Msg-id E1RLpGv-0005Jz-UH@gemulon.postgresql.org
обсуждение исходный текст
Список 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(-)


В списке pgsql-committers по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: pgsql: Avoid scanning nulls at the beginning of a btree index scan.
Следующее
От: Simon Riggs
Дата:
Сообщение: pgsql: Improve docs for timing and skipping of checkpoints