From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: When removing a left join, clean out references in EquivalenceCl
Date: Thu, 15 Jun 2023 19:24:54 +0000
Message-ID: <E1q9saU-001xZG-4o@gemulon.postgresql.org> (raw)
When removing a left join, clean out references in EquivalenceClasses.
Since commit b448f1c8d, we've been able to remove left joins
(that are otherwise removable) even when they are underneath
other left joins, a case that was previously prevented by a
delay_upper_joins check. This is a clear improvement, but
it has a surprising side-effect: it's now possible that there
are EquivalenceClasses whose relid sets mention the removed
baserel and/or outer join. If we fail to clean those up,
we may drop essential join quals due to not having any join
level that appears to satisfy their relid sets.
(It's not quite 100% clear that this was impossible before.
But the lack of complaints since we added join removal a dozen
years ago strongly suggests that it was impossible.)
Richard Guo and Tom Lane, per bug #17976 from Zuming Jiang
Discussion: https://postgr.es/m/17976-4b638b525e9a983b@postgresql.org
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/f4c00d138f6dea4c9d8af8ec280b7edc9b0a29e1
Modified Files
--------------
src/backend/optimizer/plan/analyzejoins.c | 68 +++++++++++++++++++++++++++++++
src/test/regress/expected/join.out | 31 ++++++++++++++
src/test/regress/sql/join.sql | 23 +++++++++++
3 files changed, 122 insertions(+)
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: When removing a left join, clean out references in EquivalenceCl
In-Reply-To: <E1q9saU-001xZG-4o@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