Re: first_value()/nth_value() with IGNORE NULLS loop forever (EXCLUDE GROUP/TIES, frame past partition end, no ORDER BY)

From: shihao zhong <zhong950419(at)gmail(dot)com>
To: Tatsuo Ishii <ishii(at)postgresql(dot)org>
Cc: c(dot)bhuvan(at)iitg(dot)ac(dot)in, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: first_value()/nth_value() with IGNORE NULLS loop forever (EXCLUDE GROUP/TIES, frame past partition end, no ORDER BY)
Date: 2026-10-25 16:04:37
Message-ID: CAGRkXqTAxzwW+3bp4JjZdSBizRTOOnxtpshZSWOudMtwHGU=iw@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hi Bhuvan,

Thanks for the report and the patch. I can reproduce all five queries
on master and on 19rc1.

This came in with 25a30bbd423. I think it belongs on the 19 open items.

https://wiki.postgresql.org/wiki/PostgreSQL_19_Open_Items

With your patch all five return at once and the regression tests
pass. I also compared the three functions against array_agg(x) FILTER
(WHERE x IS NOT NULL) over about 11k frame combinations. That included
spill to disk and volatile arguments. No differences.

One suggestion for the test. Could you add last_value IGNORE NULLS
with EXCLUDE TIES and no ORDER BY? It scans backward, so it would
catch a later fix in row_is_in_frame that returns -1 for every
position after the current row.

Thanks,
Shihao

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message shihao zhong 2026-10-25 18:31:11 Re: BUG #19792: BUG: Deadlock between WaitIO and read-stream look-ahead under io_method=io_uring (18.6)
Previous Message Zhijie Hou 2026-10-25 15:31:52 Re: BUG #19795: pgoutput: walsender crashes on START_REPLICATION option without a value