pgsql: Fix another cause of "wrong varnullingrels" planner failures.

Поиск
Список
Период
Сортировка
От Tom Lane
Тема pgsql: Fix another cause of "wrong varnullingrels" planner failures.
Дата
Msg-id E1qBcze-002k8s-PI@gemulon.postgresql.org
обсуждение исходный текст
Список pgsql-committers
Fix another cause of "wrong varnullingrels" planner failures.

I removed the delay_upper_joins mechanism in commit b448f1c8d,
reasoning that it was only needed when we have a single-table
(SELECT ... WHERE) as the immediate RHS child of a left join,
and we could get rid of that by hoisting the WHERE condition into
the parent join's quals.  However that new code missed a case:
we could have "foo LEFT JOIN ((SELECT ... WHERE) LEFT JOIN bar)",
and if the two left joins can be commuted then we now have the
problematic query shape.  We can fix this too easily enough,
by allowing the syntactically-lower left join to pass through
its parent qual location pointer recursively.  That lets
prepjointree.c discard the SELECT by temporarily hoisting the
WHERE condition into the ancestor join's qual.

Per bug #17978 from Zuming Jiang.

Discussion: https://postgr.es/m/17978-12f3d93a55297266@postgresql.org

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/3af87736bf5d5c7bea086d962afc2bbf4f29279a

Modified Files
--------------
src/backend/optimizer/prep/prepjointree.c | 19 +++++++++++++++----
src/test/regress/expected/join.out        | 31 ++++++++++++++++++++++++++++---
src/test/regress/sql/join.sql             |  8 ++++++++
3 files changed, 51 insertions(+), 7 deletions(-)


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: pgsql: Centralize fixups for mismatched nullingrels in nestloop params.
Следующее
От: Bruce Momjian
Дата:
Сообщение: pgsql: docs: adjust tag indenting and add MERGE mention