pgsql: pg_plan_advice: Handle custom scans that replace a join

From: Robert Haas <rhaas(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: pg_plan_advice: Handle custom scans that replace a join
Date: 2026-11-03 15:28:50
Message-ID: E1xOGRO-00000000262-2LGm@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

pg_plan_advice: Handle custom scans that replace a join

pgpa_relids() ignored CustomScan nodes, so a custom scan that replaced
a join caused the plan walker failed with "plan node has no RTIs". Fix
by returning custom_relids, so that the node is then treated as an
ordinary scan of several relations. This allows JOIN_ORDER advice to
handle it correctly.

Reported-by: Noah Misch <noah(at)leadboat(dot)com>
Discussion: https://postgr.es/m/20260827171830.68.noahmisch@microsoft.com
Discussion: https://postgr.es/m/sSMpyoJ12CV5Y3uS-T_8Z3M1xsJBELBd-Vh5DmlC9_jy9TOqMuWzr8-TuXrBpL8AlPlyEFkyQ4wX5guJCyVizY-R2UET0DpIEeA1aSsUjk4=@pm.me
Author: Dongpo Liu <poe(dot)liu(at)pm(dot)me>

Branch
------
REL_19_STABLE

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

Modified Files
--------------
contrib/pg_plan_advice/pgpa_walker.c | 2 ++
1 file changed, 2 insertions(+)

Browse pgsql-committers by date

  From Date Subject
Next Message Michael Paquier 2026-11-03 23:05:44 pgsql: test_custom_stats: Add test for drop of variable-sized stats kin
Previous Message Daniel Gustafsson 2026-11-03 13:28:32 pgsql: Remove git-external-diff from tools directory