pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Fix wrong order of operations in inheritance_planner.
2+ messages / 1 participants
[nested] [flat]

* pgsql: Fix wrong order of operations in inheritance_planner.
@ 2018-08-11 19:53  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2018-08-11 19:53 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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
------
REL_11_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/0ff8f521d40f271c57f29f0ca773981e4465b35b

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(-)



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* pgsql: Fix wrong order of operations in inheritance_planner.
@ 2018-08-11 19:53  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2018-08-11 19:53 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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(-)



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2018-08-11 19:53 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2018-08-11 19:53 pgsql: Fix wrong order of operations in inheritance_planner. Tom Lane <tgl@sss.pgh.pa.us>
2018-08-11 19:53 pgsql: Fix wrong order of operations in inheritance_planner. Tom Lane <tgl@sss.pgh.pa.us>

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