pg_plan_advice: Avoid miscategorizing partitionwise scans as ordinary. Given an Append or MergeAppend node, pgpa_build_scan needs to call pgpa_make_scan for the node's own apprelids, and also for each element of child_append_relid_sets. It did that, but it overlooked the fact that the scan type applicable to the child scans might differ from the scan type applicable to the parent scan. The problem can only occur in one direction: an RTE_SUBQUERY (Merge)Append can appear on top of a RTE_RELATION (Merge)Append, but not the reverse, so the only failure mode here is to classify a partitionwise scan of a child appendrel as PGPA_SCAN_ORDINARY rather than PGPA_SCAN_PARTITIONWISE, leading to failure to include PARTITIONWISE(something) in the generated advice string.
Backpatch-through: 19 Discussion: http://postgr.es/m/ca+tgmoyyhc4i-gpzc9-jyhqih6pok+6ltyfinr-pioxg1nk...@mail.gmail.com Branch ------ REL_19_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/afadfb3496edc40fb0988edc72df2e23b178d1a0 Modified Files -------------- contrib/pg_plan_advice/expected/partitionwise.out | 52 +++++++++++++++++++++++ contrib/pg_plan_advice/pgpa_scan.c | 9 +++- contrib/pg_plan_advice/sql/partitionwise.sql | 23 ++++++++++ 3 files changed, 82 insertions(+), 2 deletions(-)
