pgsql: Fix calculation of relid sets for partitionwise child joins.

Поиск
Список
Период
Сортировка
От Tom Lane
Тема pgsql: Fix calculation of relid sets for partitionwise child joins.
Дата
Msg-id E1qMsYH-000dLZ-HX@gemulon.postgresql.org
обсуждение исходный текст
Ответы Re: pgsql: Fix calculation of relid sets for partitionwise child joins.  (Jeff Davis <pgsql@j-davis.com>)
Список pgsql-committers
Fix calculation of relid sets for partitionwise child joins.

Applying add_outer_joins_to_relids() to a child join doesn't actually
work, even if we've built a SpecialJoinInfo specialized to the child,
because that function will also compare the join's relids to elements
of the main join_info_list, which only deal in regular relids not
child relids.  This mistake escaped detection by the existing
partitionwise join tests because they didn't test any cases where
add_outer_joins_to_relids() needs to add additional OJ relids (that
is, any cases where join reordering per identity 3 is possible).

Instead, let's apply adjust_child_relids() to the relids of the parent
join.  This requires minor code reordering to collect the relevant
AppendRelInfo structures first, but that's work we'd do shortly anyway.

Report and fix by Richard Guo; cosmetic changes by me

Discussion: https://postgr.es/m/CAMbWs49NCNbyubZWgci3o=_OTY=snCfAPtMnM-32f3mm-K-Ckw@mail.gmail.com

Branch
------
master

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

Modified Files
--------------
src/backend/optimizer/path/joinrels.c        | 14 +++++----
src/backend/optimizer/util/relnode.c         | 18 +++++++----
src/test/regress/expected/partition_join.out | 46 ++++++++++++++++++++++++++++
src/test/regress/sql/partition_join.sql      |  9 ++++++
4 files changed, 75 insertions(+), 12 deletions(-)


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

Предыдущее
От: Amit Langote
Дата:
Сообщение: pgsql: Code review for commit b6e1157e7d
Следующее
От: Jeff Davis
Дата:
Сообщение: pgsql: ICU: remove negative test that fails to fail.