pgsql: pg_plan_advice: Avoid miscategorizing partitionwise scans as ord - Mailing list pgsql-committers

From Robert Haas
Subject pgsql: pg_plan_advice: Avoid miscategorizing partitionwise scans as ord
Date
Msg-id E1xErTj-00000000pxL-010g@gemulon.postgresql.org
Whole thread
List pgsql-committers
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-PioXG1nKkOQ@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/8606fb3f449301cb6c7636eed9eecf5dd267e8fb

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


pgsql-committers by date:

Previous
From: Robert Haas
Date:
Subject: pgsql: Fix failure of setrefs.c to process child_append_relid_sets
Next
From: Masahiko Sawada
Date:
Subject: pgsql: Stabilize recently added tests in 051_effective_wal_level.pl.