pgsql: Fix failure of setrefs.c to process child_append_relid_sets

From: Robert Haas <rhaas(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Fix failure of setrefs.c to process child_append_relid_sets
Date: 2026-10-08 16:24:49
Message-ID: E1xEqvJ-00000000pk5-1v9Y@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix failure of setrefs.c to process child_append_relid_sets

Commit 7358abcc6076f4b2530d10126ab379f8aea612a5 taught the planner to
store information about Append node consolidation in the final plan,
but it forgot that child_append_relid_sets needs to be adjusted
at setrefs.c time just like every other place where we store RTIs
in a plan tree. Fix that.

Although this can cause incorrect plan advice to be emitted in cases
involving multi-level partitioning, it seems more appropriate to put
the test case for it in pg_overexplain, so this commit does that.

Backpatch-through: 19
Discussion: http://postgr.es/m/CA+TgmoYYHC4i-Gpzc9-JYHqih6pOK+6LTYFiNR-PioXG1nKkOQ@mail.gmail.com

Branch
------
REL_19_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/b718dafc70a348dd7876858f5c4c42554a1cf568

Modified Files
--------------
contrib/pg_overexplain/expected/pg_overexplain.out | 75 ++++++++++++++++++++++
contrib/pg_overexplain/sql/pg_overexplain.sql | 23 +++++++
src/backend/optimizer/plan/setrefs.c | 23 +++++++
3 files changed, 121 insertions(+)

Browse pgsql-committers by date

  From Date Subject
Next Message Robert Haas 2026-10-08 17:00:23 pgsql: pg_plan_advice: Avoid miscategorizing partitionwise scans as ord
Previous Message Peter Eisentraut 2026-10-08 15:44:12 Re: pgsql: Optimize tuple deformation