From: | Tatsuo Ishii <ishii(at)sraoss(dot)co(dot)jp> |
---|---|
To: | tgl(at)sss(dot)pgh(dot)pa(dot)us |
Cc: | andrew(at)tao11(dot)riddles(dot)org(dot)uk, pgsql-hackers(at)postgresql(dot)org, david(at)fetter(dot)org, ojford(at)gmail(dot)com, krasiyan(at)gmail(dot)com |
Subject: | Re: Add RESPECT/IGNORE NULLS and FROM FIRST/LAST options |
Date: | 2023-04-22 12:14:43 |
Message-ID: | 20230422.211443.198170013083726417.t-ishii@sranhm.sra.co.jp |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
I revisited the thread:
https://www.postgresql.org/message-id/flat/CAGMVOdsbtRwE_4%2Bv8zjH1d9xfovDeQAGLkP_B6k69_VoFEgX-A%40mail.gmail.com
and came up with attached POC patch (I used some varibale names
appearing in the Krasiyan Andreev's patch). I really love to have
RESPECT/IGNORE NULLS because I believe they are convenient for
users. For FIRST/LAST I am not so excited since there are alternatives
as our document stats, so FIRST/LAST are not included in the patch.
Currently in the patch only nth_value is allowed to use RESPECT/IGNORE
NULLS. I think it's not hard to implement it for others (lead, lag,
first_value and last_value). No document nor test patches are
included for now.
Note that RESPECT/IGNORE are not registered as reserved keywords in
this patch (but registered as unreserved keywords). I am not sure if
this is acceptable or not.
> The questions of how we interface to the individual window functions
> are really independent of how we handle the parsing problem. My
> first inclination is to just pass the flags down to the window functions
> (store them in WindowObject and provide some additional inquiry functions
> in windowapi.h) and let them deal with it.
I agree with this. Also I do not change the prototype of
nth_value. So I pass RESPECT/IGNORE NULLS information from the raw
parser to parse/analysis and finally to WindowObject.
> It's also worth wondering if we couldn't just implement the flags in
> some generic fashion and not need to involve the window functions at
> all. FROM LAST, for example, could and perhaps should be implemented
> by inverting the sort order. Possibly IGNORE NULLS could be implemented
> inside the WinGetFuncArgXXX functions? These behaviors might or might
> not make much sense with other window functions, but that doesn't seem
> like it's our problem.
Yes, probably we could make WinGetFuncArgXXX a little bit smarter in
this direction (not implemented in the patch at this point).
Best reagards,
--
Tatsuo Ishii
SRA OSS LLC
English: http://www.sraoss.co.jp/index_en/
Japanese:http://www.sraoss.co.jp
Attachment | Content-Type | Size |
---|---|---|
v1-0001-Implement-IGNORE-or-RESPECT-NULLS-parse-analysis-.patch | text/x-patch | 8.3 KB |
v1-0002-Implement-IGNORE-or-RESPECT-NULLS-planner-part.patch | text/x-patch | 826 bytes |
v1-0003-Implement-IGNORE-or-RESPECT-NULLS-executor-and-wi.patch | text/x-patch | 3.2 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Oliver Ford | 2023-04-22 12:38:50 | Re: Add RESPECT/IGNORE NULLS and FROM FIRST/LAST options |
Previous Message | Michael Paquier | 2023-04-22 12:10:18 | Re: run pgindent on a regular basis / scripted manner |