Re: Add RESPECT/IGNORE NULLS and FROM FIRST/LAST options - Mailing list pgsql-hackers

From Tatsuo Ishii
Subject Re: Add RESPECT/IGNORE NULLS and FROM FIRST/LAST options
Date
Msg-id 20250122.205818.930169577391749915.ishii@postgresql.org
Whole thread Raw
In response to Add RESPECT/IGNORE NULLS and FROM FIRST/LAST options  (Oliver Ford <ojford@gmail.com>)
List pgsql-hackers
> Attached version moves the setting of IGNORE_NULLS to the window
> function itself, with the functions that don't allow it erroring out.
> This is done with a new api: WinCheckAndInitializeNullTreatment.
> 
> Custom functions that don't call this will simply not have the
> IGNORE_NULLS option set as this api initializes the option and the
> array. As per the previous discussion, it should have correct
> formatting and handle the Exclusion clauses correctly.

I played with the v4 patch. It seems lead() produces incorrect result:

test=# SELECT x,y,lead(y) IGNORE NULLS OVER (ORDER BY x) FROM (VALUES(1,NULL),(2,2),(3,NULL)) AS v(x,y);
 x | y | lead 
---+---+------
 1 |   |    2
 2 | 2 |    2
 3 |   |    2
(3 rows)

I think correct result of "lead" column is 2, NULL, NULL.

Best reagards,
--
Tatsuo Ishii
SRA OSS K.K.
English: http://www.sraoss.co.jp/index_en/
Japanese:http://www.sraoss.co.jp



pgsql-hackers by date:

Previous
From: Bertrand Drouvot
Date:
Subject: Re: doc: explain pgstatindex fragmentation
Next
From: Japin Li
Date:
Subject: Re: [RFC] Lock-free XLog Reservation from WAL