Re: BUG #19102: Assertion failure in generate_orderedappend_paths with aggregate pushdown - Mailing list pgsql-bugs

From Richard Guo
Subject Re: BUG #19102: Assertion failure in generate_orderedappend_paths with aggregate pushdown
Date
Msg-id CAMbWs49ONLr4-_X3xe5nMgy-Jaqju_Cn0osaj3RMSsV-9Pd2Cg@mail.gmail.com
Whole thread Raw
In response to Re: BUG #19102: Assertion failure in generate_orderedappend_paths with aggregate pushdown  (Richard Guo <guofenglinux@gmail.com>)
Responses Re: BUG #19102: Assertion failure in generate_orderedappend_paths with aggregate pushdown
Re: BUG #19102: Assertion failure in generate_orderedappend_paths with aggregate pushdown
List pgsql-bugs
On Mon, Nov 3, 2025 at 10:09 PM Richard Guo <guofenglinux@gmail.com> wrote:
> Reading generate_orderedappend_paths(), I noticed a couple of other
> issues:
>
> 1. This function considers the cheapest-fractional case in addition to
> the cheapest-startup and cheapest-total cases, but the function's
> comment does not mention this.
>
>  * We consider both cheapest-startup and cheapest-total cases, ie, for each
>  * interesting ordering, collect all the cheapest startup subpaths and all the
>  * cheapest total paths, and build a suitable path for each case.
>
> 2. The function does not handle the case where the paths in
> total_subpaths and fractional_subpaths are identical.  This is not a
> rare scenario, and as a result, it could create two exactly identical
> ordered append paths.
>
> 3. The comment for startup_neq_total is also out of date, since we may
> call create_append_path(), not just create_merge_append_path(), to
> generate ordered append paths.
>
> Here is a WIP patch to address these issues.

Here are the updated patches.  I split the changes into two: 0001
fixes the Assert failure and updates the out-of-date comment for
generate_orderedappend_paths(), while 0002 addresses the second and
third issues I described upthread.

The assertion failure also exists in v18, so I think it would be best
to get 0001 pushed and backpatched before the code freeze.  I'm not
sure whether 0002 should be backpatched.  Before that, I'd like to
know whether these two patches make sense.

Any thoughts?

- Richard

Attachment

pgsql-bugs by date:

Previous
From: Michael Paquier
Date:
Subject: Re: BUG #19093: Behavioral change in walreceiver termination between PostgreSQL 14.17 and 14.18
Next
From: Xuneng Zhou
Date:
Subject: Re: BUG #19093: Behavioral change in walreceiver termination between PostgreSQL 14.17 and 14.18