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

From Kuntal Ghosh
Subject Re: BUG #19102: Assertion failure in generate_orderedappend_paths with aggregate pushdown
Date
Msg-id CAGz5QCKuD54qPVnQAUXEoQzWmpVNty8NNoMNnKzrSE3qBRCJDw@mail.gmail.com
Whole thread Raw
Responses Re: BUG #19102: Assertion failure in generate_orderedappend_paths with aggregate pushdown
List pgsql-bugs

On Mon, Nov 3, 2025 at 11:22 AM PG Bug reporting form <noreply@postgresql.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 & Regards,
Kuntal Ghosh
Attachment

pgsql-bugs by date:

Previous
From: PG Bug reporting form
Date:
Subject: BUG #19102: Assertion failure in generate_orderedappend_paths with aggregate pushdown
Next
From: "Haiyang Li"
Date:
Subject: Re: BUG #19100: Different column type between partitioned table and detached pending partition table make errors