> 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