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 <[email protected]>
Discussion: 
http://postgr.es/m/CA+Tgmob3X+_CSjAa_BtU9bXrX_ge_HyvO=7gscltbpncgwn...@mail.gmail.com
Tested-by: Jakub Wartak <[email protected]>
Backpatch-through: 19

Branch
------
REL_19_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/82bd4e644d669dcda98562073098594eb1eba654

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

Reply via email to