From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix another cause of "wrong varnullingrels" planner failures.
Date: Tue, 20 Jun 2023 15:10:07 +0000
Message-ID: <E1qBcze-002k8s-PI@gemulon.postgresql.org> (raw)
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(-)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-committers@postgresql.org
Cc: tgl@sss.pgh.pa.us, pgsql-committers@lists.postgresql.org
Subject: Re: pgsql: Fix another cause of "wrong varnullingrels" planner failures.
In-Reply-To: <E1qBcze-002k8s-PI@gemulon.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox