pgsql: Fix wrong order of operations in inheritance_planner.

Поиск
Список
Период
Сортировка
От Tom Lane
Тема pgsql: Fix wrong order of operations in inheritance_planner.
Дата
Msg-id E1foZx2-0003ko-E4@gemulon.postgresql.org
обсуждение исходный текст
Список pgsql-committers
Fix wrong order of operations in inheritance_planner.

When considering a partitioning parent rel, we should stop processing that
subroot as soon as we've done adjust_appendrel_attrs and any securityQuals
updates.  The rest of this is unnecessary, and indeed adding duplicate
subquery RTEs to the subroot is *wrong*.  As the code stood, the children
of that partition ended up with two sets of copied subquery RTEs, confusing
matters greatly.  Even more hilarity ensued if all of the children got
excluded by constraint exclusion, so that the extra RTEs didn't make it
back into the parent rtable.

Per fuzz testing by Andreas Seltenreich.  Back-patch to v11 where this
got broken (by commit 0a480502b, it looks like).

Discussion: https://postgr.es/m/87va8g7vq0.fsf@ansel.ydns.eu

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/4a2994f055be9405a254b22de6cd2107a0f46563

Modified Files
--------------
src/backend/optimizer/plan/planner.c         | 106 ++++++++++++++-------------
src/test/regress/expected/partition_join.out |  43 +++++++++++
src/test/regress/sql/partition_join.sql      |  12 +++
3 files changed, 111 insertions(+), 50 deletions(-)


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: pgsql: Distinguish printf-like functions that support %m from thosetha
Следующее
От: Tom Lane
Дата:
Сообщение: pgsql: Fix bogus loop logic in 013_crash_restart test's pump_untilsubr