Re: [PATCH] Add row estimate tests for unnest() and integer generate_series()

From: solai v <solai(dot)cdac(at)gmail(dot)com>
To: shihao zhong <zhong950419(at)gmail(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: [PATCH] Add row estimate tests for unnest() and integer generate_series()
Date: 2026-09-15 11:33:57
Message-ID: CAF0whudFdXw=W2_7UFLcY8MUV2TN-PAmJ92QX0rJwUJ-hz6Cgw@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi all,

On Tue, Sep 15, 2026 at 3:20 PM shihao zhong <zhong950419(at)gmail(dot)com> wrote:
>
> Hi hackers,
>
> The support functions for unnest() and the integer variants of
> generate_series() have no regression tests for their row estimates.
>
> They were added in v12, before planner_est.sql existed. The numeric
> and timestamp variants got tests together with their support
> functions.
>
> The attached patch adds sections for both, following the existing
> style. Test changes only.
>

Thank you for the patch. I reviewed the patch and tested it on my
local PostgreSQL tree. The patch applies cleanly and is limited to
regression test changes in planner_est.sql and planner_est.out. I ran
the focused regression test: # All 245 tests passed. I manually
verified the added cases for both generate_series() and unnest(). The
row estimates matched the expected behavior for normal, stepped,
descending, bigint, and large-range generate_series() cases. The empty
and NULL cases correctly show an estimate of 1 after clamping, and the
zero-step case falls back to the default estimate and raises the
expected error during execution. For unnest(), I verified constant and
multidimensional arrays, empty/NULL arrays, ArrayExpr,
statistics-based estimation, and the default estimate when
array-column statistics are unavailable. The observed results matched
the expected regression output. I did not find any functional issues
with the patch.
One minor comment clarification could be considered: the comment for
the constant NULL generate_series() case says "-- Ensure a constant
NULL argument estimates no rows", while the final planner estimate is
1 due to clamping. This could perhaps be worded consistently with the
corresponding unnest() test.
Apart from this minor wording point, the patch looks good to me.

Regards,
Solai

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Nathan Bossart 2026-09-15 11:59:10 Re: Trying to break online checksums with LLMs
Previous Message Etsuro Fujita 2026-09-15 11:31:26 Re: Several issues with postgres_fdw stats import