Re: Add RESPECT/IGNORE NULLS and FROM FIRST/LAST options
Tatsuo Ishii <ishii@sraoss.co.jp>
From: Tatsuo Ishii <ishii@sraoss.co.jp>
To: vik@postgresfriends.org
Cc: tgl@sss.pgh.pa.us, andrew@tao11.riddles.org.uk,
pgsql-hackers@postgresql.org, david@fetter.org, ojford@gmail.com,
krasiyan@gmail.com
Date: 2023-04-23T01:24:02Z
Lists: pgsql-hackers
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Fix coding style with "else".
- 20628b62e46e 19 (unreleased) landed
-
Fix multi WinGetFuncArgInFrame/Partition calls with IGNORE NULLS.
- 2d7b247cb414 19 (unreleased) landed
-
Fix Coverity issue reported in commit 2273fa32bce.
- dd766a441d69 19 (unreleased) landed
-
Use ereport rather than elog in WinCheckAndInitializeNullTreatment.
- 5f3808646f67 19 (unreleased) landed
-
Avoid uninitialized-variable warnings from older compilers.
- 71540dcdcb22 19 (unreleased) cited
-
Fix Coverity issues reported in commit 25a30bbd423.
- 2273fa32bce7 19 (unreleased) landed
-
Improve EXPLAIN's display of window functions.
- 8b1b342544b6 18.0 cited
-
Automatically generate node support functions
- 964d01ae90c3 16.0 cited
> Excellent. I was thinking about picking my version of this patch up > again, but I think this might be better than mine. Thanks. > I am curious why set_mark is false in the IGNORE version instead of > also being const_offset. Surely the nth non-null in the frame will > never go backwards. Initially I thought that too. But when I used const_offset instead of false. I got an error: ERROR: cannot fetch row before WindowObject's mark position > I do agree that we can have <null treatment> without <from first or > last> so let's move forward with this and handle the latter later. Agreed. >> Currently in the patch only nth_value is allowed to use RESPECT/IGNORE >> NULLS. > > This should not be hard coded. It should be a new field in pg_proc > (with a sanity check that it is only true for window functions). That > way custom window functions can implement it. There were some discussions on this in the past. https://www.postgresql.org/message-id/flat/CAGMVOdsbtRwE_4%2Bv8zjH1d9xfovDeQAGLkP_B6k69_VoFEgX-A%40mail.gmail.com It seems Tom and Andrew thought that "1.1.2. Change the behavior of the windowapi in some consistent way" is ambitious. If we follow this direction, I think each window function should check WindowFunc struct passed by WinGetWindowFunc (added in my patch) to check whether IGNORE NULLS can be applied or not in the function. If not, error out. This way, we don't need to add a new field to pg_proc. >> No document nor test patches are included for now. > > I can volunteer to work on these if you want. Thanks! I think you can work on top of the last patch posted by Krasiyan Andreev: https://www.postgresql.org/message-id/CAN1PwonAnC-KkRyY%2BDtRmxQ8rjdJw%2BgcOsHruLr6EnF7zSMH%3DQ%40mail.gmail.com Best reagards, -- Tatsuo Ishii SRA OSS LLC English: http://www.sraoss.co.jp/index_en/ Japanese:http://www.sraoss.co.jp