pgsql: Propagate disabled_nodes to single-child Append paths

From: Richard Guo <rguo(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Propagate disabled_nodes to single-child Append paths
Date: 2026-08-28 06:06:57
Message-ID: E1wzpjs-00000002Req-17ps@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Propagate disabled_nodes to single-child Append paths

create_append_path() skips cost_append() when an Append has exactly
one child whose parallel awareness matches its own, since setrefs.c
strips such an Append out entirely. In that case it copies the
child's rowcount and costs directly, but it failed to copy
disabled_nodes. An Append over a disabled child therefore claimed to
contain no disabled nodes, letting a disabled path win over one that
is not disabled.

This is a regression in v18; before e22253467, disable_cost was folded
into a path's startup and total costs, so it rode along in the fields
this shortcut already copies.

Back-patch to v18. This can change plans in stable branches, but only
for installations that have explicitly disabled a node type, and only
to stop using the node they asked us to avoid.

Reported-by: Man Zeng <zengman(at)halodbtech(dot)com>
Author: Tender Wang <tndrwang(at)gmail(dot)com>
Reviewed-by: Richard Guo <guofenglinux(at)gmail(dot)com>
Reviewed-by: David Rowley <dgrowleyml(at)gmail(dot)com>
Discussion: https://postgr.es/m/CAHewXNm_Zx5EDoaD7wo7bq6cfRroNznS+RBCzT_p2-CWQXpgSw@mail.gmail.com
Backpatch-through: 18

Branch
------
REL_19_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/15ccc2041ee864cccc8b72de4a1f21e9b51ccc47

Modified Files
--------------
src/backend/optimizer/util/pathnode.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Andrew Dunstan 2026-08-28 13:39:23 pgsql: Make platform guards in two regression tests match meson builds
Previous Message David Rowley 2026-08-28 01:13:18 pgsql: Fix incorrect multi-column RANGE partition pruning