pgsql: Respect disabled_nodes in fix_alternative_subplan.

From: Robert Haas <rhaas(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Respect disabled_nodes in fix_alternative_subplan.
Date: 2026-03-26 14:38:02
Message-ID: E1w5lqT-001YPx-2u@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Respect disabled_nodes in fix_alternative_subplan.

When my commit e22253467942fdb100087787c3e1e3a8620c54b2 added the
concept of disabled_nodes, it failed to add a disabled_nodes field
to SubPlan. This is a regression: before that commit, when
fix_alternative_subplan compared the costs of two plans, the number
of disabled nodes affected the result, because it was just a
component of the total cost. After that commit, it no longer did,
making it possible for a disabled path to win on cost over one that
is not disabled. Fix that.

As usual for planner fixes that might destabilize plan choices,
no back-patch.

Discussion: https://postgr.es/m/CA+TgmoaK=4w7-qknUo3QhUJ53pXZq=c=KgZmRyD+k7ytqfmgSg@mail.gmail.com
Reviewed-by: Lukas Fittl <lukas(at)fittl(dot)com>

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/47c110f77e75ed7efd54c3b152f7da2350522f8c

Modified Files
--------------
src/backend/optimizer/path/costsize.c | 1 +
src/backend/optimizer/plan/setrefs.c | 14 ++++++++++----
src/include/nodes/primnodes.h | 1 +
3 files changed, 12 insertions(+), 4 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Andres Freund 2026-03-26 14:47:46 pgsql: Fix off-by-one error in read IO tracing
Previous Message Peter Eisentraut 2026-03-26 14:06:03 pgsql: Fix -Wcast-qual warning