pgsql: pg_plan_advice: Fix advice feedback JOIN_ORDER over a single sub

From: Robert Haas <rhaas(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: pg_plan_advice: Fix advice feedback JOIN_ORDER over a single sub
Date: 2026-10-09 18:14:28
Message-ID: E1xFF6y-00000000yaW-0DGp@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

pg_plan_advice: Fix advice feedback JOIN_ORDER over a single sublist.

Suppose that a JOIN_ORDER() advice target consists of a single
ordered or unordered sublist, something like JOIN_ORDER((...))
or JOIN_ORDER({...}) or even JOIN_ORDER(({...})). In the previous
coding, the feedback for such advice would be "partially matched"
even when the query joined all the relations mentioned. Fix that.

Like the issues fixed by e1d8f81d4961ca6c4228eb9a3ab5d36168008e42,
this escaped detection because advice generation never creates
advice strings that have the problematic form.

Reported-by: Ayush Tiwari <ayushtiwari(dot)slg01(at)gmail(dot)com>
Discussion: http://postgr.es/m/CAJTYsWWe8E8ya-24wRws5LSVhHNxCwLyy8c-ueY-TKvC=8P7UQ@mail.gmail.com
Discussion: http://postgr.es/m/CA+TgmoYYHC4i-Gpzc9-JYHqih6pOK+6LTYFiNR-PioXG1nKkOQ@mail.gmail.com
Backpatch-through: 19

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/f6065c56d47eceb70c75de37a5ba214c67f73533

Modified Files
--------------
contrib/pg_plan_advice/expected/join_order.out | 59 ++++++++++++++++++++++++++
contrib/pg_plan_advice/pgpa_planner.c | 21 ++++++++-
contrib/pg_plan_advice/sql/join_order.sql | 16 +++++++
3 files changed, 95 insertions(+), 1 deletion(-)

Browse pgsql-committers by date

  From Date Subject
Previous Message Robert Haas 2026-10-09 17:13:37 pgsql: pg_plan_advice: Don't suppress NO_GATHER advice for parent rels.