pgsql: pg_plan_advice: Mark PARTITIONWISE inapplicable on plain rels.

From: Robert Haas <rhaas(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: pg_plan_advice: Mark PARTITIONWISE inapplicable on plain rels.
Date: 2026-10-29 15:56:49
Message-ID: E1xMSUj-00000001HCi-0Km2@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

pg_plan_advice: Mark PARTITIONWISE inapplicable on plain rels.

Previously, such advice was accepted, and just had the effect of disabling
every path for the target relation, which isn't the worst imaginable
behavior, but it's not difficult to do better. This commit causes such
advice to instead be marked inapplicable, like INDEX_SCAN(some_table
NO_SUCH_INDEX).

One advantage of this change is that it improves the test coverage
provided by test_plan_advice. In fact, prior to commit
0f7dfd7936b9e99f9aeca00f52ab1692898ffff4, these changes caused
test_plan_advice failures, because the defect fixed by that commit
caused PARTITIONWISE advice to target the wrong relations. Without
this change, the advice feedback doesn't show any sign that there's
a problem, which is how that defect escaped discovery.

Reported-by: Nikolay Samokhvalov <nik(at)postgres(dot)ai>
Discussion: http://postgr.es/m/CA+Tgmob3X+_CSjAa_BtU9bXrX_ge_HyvO=7gSCLtBpncGwn-kQ@mail.gmail.com
Tested-by: Jakub Wartak <jakub(dot)wartak(at)enterprisedb(dot)com>
Backpatch-through: 19

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/2a55a15d6b7c1374716df427e701c46c009fbe2d

Modified Files
--------------
contrib/pg_plan_advice/expected/partitionwise.out | 49 +++++++++++++++++++++++
contrib/pg_plan_advice/pgpa_planner.c | 42 ++++++++++++++++++-
contrib/pg_plan_advice/sql/partitionwise.sql | 10 +++++
3 files changed, 99 insertions(+), 2 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Previous Message Robert Haas 2026-10-29 15:03:30 pgsql: pg_plan_advice: Suppress advice from unflattened set operations.