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-24cd399df6c80...@postgresql.org Branch ------ REL_16_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/94c02bd3345d7837bc1f240c14db2222c85aa18c Modified Files -------------- src/backend/optimizer/plan/setrefs.c | 12 +++++++++++ src/test/regress/expected/partition_prune.out | 29 +++++++++++++++++++++++++++ src/test/regress/sql/partition_prune.sql | 15 ++++++++++++++ 3 files changed, 56 insertions(+)