Re: BUG #19732: first_value/last_value/nth_value return NULL with EXCLUDE TIES when the current row is outside its f

From: Andrey Rachitskiy <pl0h0yp1(at)gmail(dot)com>
To: shihao zhong <zhong950419(at)gmail(dot)com>
Cc: theshallow27(at)gmail(dot)com, 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-05 11:20:28
Message-ID: CAB8bMiveKc4K7TsR89Rt_ZS_buGnvPD-fysqw_+dRtNECb2mKw@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

пн, 5 окт. 2026 г. в 07:39, shihao zhong <zhong950419(at)gmail(dot)com>:

>
> v2 looks good, I checked first_value, last_value and nth_value
> against array_agg for every frame shape, and they all match now.
>
> Maybe one more test
>
> SELECT k, first_value(k) OVER w
> FROM (VALUES (0), (1), (1), (1), (2)) t(k)
> WINDOW w AS (ORDER BY k ROWS BETWEEN 2 FOLLOWING AND UNBOUNDED FOLLOWING
> EXCLUDE TIES);
>
> On Master it report ERROR: cannot fetch row before WindowObject's mark
> position
>
>
Hi, Shihao!
Thanks for the review.
Added in v3.

Attachment Content-Type Size
v3-0001-Fix-first_value-nth_value-and-last_value-with-EXC.patch text/x-patch 6.2 KB

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message PG Bug reporting form 2026-10-05 13:52:10 BUG #19751: MIN aggregate + FETCH FIRST 1 ROW WITH TIES causes false 21000 error when index scan is forced
Previous Message Heikki Linnakangas 2026-10-05 10:20:35 Re: BUG #19628: Uninterruptible vacuum during hash index processing