pgsql: Fix setrefs.c's failure to do expression processing on prune ste

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Fix setrefs.c's failure to do expression processing on prune ste
Date: 2025-01-17 01:40:26
Message-ID: E1tYbLW-0020CW-62@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix setrefs.c's failure to do expression processing on prune steps.

We should run the expression subtrees of PartitionedRelPruneInfo
structs through fix_scan_expr. Failure to do so means that
AlternativeSubPlans within those expressions won't be cleaned up
properly, resulting in "unrecognized node type" errors since v14.

It seems fairly likely that at least some of the other steps done
by fix_scan_expr are important here as well, resulting in as-yet-
undetected bugs. Therefore, I've chosen to back-patch this to
all supported branches including v13, even though the known
symptom doesn't manifest in v13.

Per bug #18778 from Alexander Lakhin.

Discussion: https://postgr.es/m/18778-24cd399df6c806af@postgresql.org

Branch
------
REL_13_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/45004f527afaf415f88272710883e9c473b5a2f6

Modified Files
--------------
src/backend/optimizer/plan/setrefs.c | 12 ++++++++++
src/test/regress/expected/partition_prune.out | 32 +++++++++++++++++++++++++++
src/test/regress/sql/partition_prune.sql | 15 +++++++++++++
3 files changed, 59 insertions(+)

Browse pgsql-committers by date

  From Date Subject
Next Message Nathan Bossart 2025-01-17 02:55:47 pgsql: Remove redefinitions of SIG_* macros in win32_port.h.
Previous Message Melanie Plageman 2025-01-16 23:44:36 pgsql: Add and use BitmapHeapScanDescData struct