| From: | Andrey Rachitskiy <pl0h0yp1(at)gmail(dot)com> |
|---|---|
| To: | QQ Mail <781408517(at)qq(dot)com> |
| Cc: | pgsql-bugs(at)lists(dot)postgresql(dot)org |
| Subject: | Re: BUG #19732: first_value/last_value/nth_value return NULL with EXCLUDE TIES when the current row is outside its f |
| Date: | 2026-10-12 15:18:52 |
| Message-ID: | CAB8bMitM01bphvvik4hPtMh93=FMLUaFcKP+Jpch3mzHwZrYUw@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-bugs |
пн, 12 окт. 2026 г. в 13:14, QQ Mail <781408517(at)qq(dot)com>:
> One regression suggestion: could we also include nth_value with n greater
> than 1? This small case returns the wrong non-NULL value before the patch:
>
> SELECT k, nth_value(k, 2) OVER w,
> (array_agg(k) OVER w)[2] AS expected
> FROM (VALUES (0), (0), (1), (2)) AS t(k)
> WINDOW w AS (
> ORDER BY k
> ROWS BETWEEN 1 FOLLOWING AND UNBOUNDED FOLLOWING
> EXCLUDE TIES
> );
>
> For the first row, the unpatched code returns 1 instead of 2. With v3,
> both columns return 2.
>
>
>
Hi,
Thanks for the test.
Added in v4.
| Attachment | Content-Type | Size |
|---|---|---|
| v4-0001-Fix-first_value-nth_value-and-last_value-with-EXC.patch | text/x-patch | 6.9 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Kelly Morrison | 2026-10-12 17:03:10 | postgres_fdw: semi-join pushdown generates invalid remote SQL ("missing FROM-clause entry") with a nested correlated subquery |
| Previous Message | PG Bug reporting form | 2026-10-12 12:25:57 | BUG #19755: Server-wide hang: DROP DATABASE waits forever for ProcSignalBarrier while VACUUM waits on pg_databas |