pgsql: When removing a left join, clean out references in EquivalenceCl

Поиск
Список
Период
Сортировка
От Tom Lane
Тема pgsql: When removing a left join, clean out references in EquivalenceCl
Дата
Msg-id E1q9saU-001xZG-4o@gemulon.postgresql.org
обсуждение исходный текст
Список pgsql-committers
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(+)


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

Предыдущее
От: Amit Langote
Дата:
Сообщение: pgsql: Remove outdated reference to a removed file
Следующее
От: Amit Langote
Дата:
Сообщение: pgsql: Fix typo in comment.