From: Robert Haas <rhaas@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: pg_plan_advice: Handle custom scans that replace a join
Date: Tue, 03 Nov 2026 15:28:50 +0000
Message-ID: <E1xOGRO-00000000262-2LGm@gemulon.postgresql.org> (raw)
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@leadboat.com>
Discussion: https://postgr.es/m/20260827171830.68.noahmisch@microsoft.com
Discussion: https://postgr.es/m/sSMpyoJ12CV5Y3uS-T_8Z3M1xsJBELBd-Vh5DmlC9_jy9TOqMuWzr8-TuXrBpL8AlPlyEFkyQ4wX5guJ...
Author: Dongpo Liu <poe.liu@pm.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(+)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-committers@postgresql.org
Cc: rhaas@postgresql.org
Subject: Re: pgsql: pg_plan_advice: Handle custom scans that replace a join
In-Reply-To: <E1xOGRO-00000000262-2LGm@gemulon.postgresql.org>
References: <E1xOGRO-00000000262-2LGm@gemulon.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox