Re: BUG #19102: Assertion failure in generate_orderedappend_paths with aggregate pushdown

From: Richard Guo <guofenglinux(at)gmail(dot)com>
To: Kuntal Ghosh <kuntalghosh(dot)2007(at)gmail(dot)com>
Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org, akorotkov(at)postgresql(dot)org
Subject: Re: BUG #19102: Assertion failure in generate_orderedappend_paths with aggregate pushdown
Date: 2025-11-03 10:09:25
Message-ID: CAMbWs488hC_ysSQG0ukSgaCbFNOZNMR75ryagscDY8x3bCx+GA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Mon, Nov 3, 2025 at 2:58 PM Kuntal Ghosh <kuntalghosh(dot)2007(at)gmail(dot)com> wrote:
> On Mon, Nov 3, 2025 at 11:22 AM PG Bug reporting form <noreply(at)postgresql(dot)org> wrote:
>> Server crashes with assertion failure:
>> TRAP: FailedAssertion("childrel->rows > 0", File: "allpaths.c", Line: 1983)
>>
>> To fix the issue, we can replace the direct division with
>> clamp_row_est(childrel->rows) to safely handle zero, and remove the
>> incorrect assertion:
>>
>> - Assert(childrel->rows > 0);
>> - path_fraction /= childrel->rows;
>> + path_fraction /= clamp_row_est(childrel->rows);
>>
> Added a patch with the proposed fix and regression test.

Thanks for the report -- that's a good catch. However, I don't think
we should use childrel->rows to calculate the fraction in the first
place. It would be better to use cheapest_total->rows instead.

- Richard

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Richard Guo 2025-11-03 13:09:44 Re: BUG #19102: Assertion failure in generate_orderedappend_paths with aggregate pushdown
Previous Message Haiyang Li 2025-11-03 09:16:02 Re: BUG #19100: Different column type between partitioned table and detached pending partition table make errors