Re: [PATCH] Fix disabled_nodes propagation for single-child Append paths

From: Richard Guo <guofenglinux(at)gmail(dot)com>
To: Tender Wang <tndrwang(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, zengman(at)halodbtech(dot)com
Subject: Re: [PATCH] Fix disabled_nodes propagation for single-child Append paths
Date: 2026-08-27 07:36:32
Message-ID: CAMbWs4-dP6A1xF_u_6Q51sTE0xikNo5Av3iB6sMUk2PrSvQabQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Aug 17, 2026 at 3:59 PM Tender Wang <tndrwang(at)gmail(dot)com> wrote:
> The problem is in `create_append_path()`. When an Append has only one
> child and both have the same parallel-awareness, it skips
> `cost_append()` and copies the child's rows and costs directly:
...
> However, `child->disabled_nodes` is not copied. As a result, an
> AppendPath whose child has `disabled_nodes = 1` can incorrectly have
> `disabled_nodes = 0`, which affects subsequent path selection.

Good catch, and the fix is right. setrefs.c removes such an Append so
the node is gone at execution time and copying the child's count
verbatim is what we want.

I think we need to update the comment above this code. Also, I don't
think we need the test case. None of previous fixes to oversights of
this shape carried test case, such as 47c110f77 and 6e466e1e8. A
plan-shape test here does not seem stable enough.

For the same reason as those commits, I'd also leave this master-only.
It is a v17 regression, but planner fixes risk destabilizing plans in
stable branches, and this doesn't seem severe enough to be an
exception.

I plan to push the attached patch if there are no objections.

- Richard

Attachment Content-Type Size
v2-0001-Propagate-disabled_nodes-to-single-child-Append-p.patch application/octet-stream 2.6 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bingshuai Li 2026-08-27 07:38:22 Re: Bug in logical decoding with DDL and subtransactions
Previous Message Masahiko Sawada 2026-08-27 07:35:17 Re: pg_upgrade silently truncates nextMultiOffset to 32 bits