Re: Add RESPECT/IGNORE NULLS and FROM FIRST/LAST options

2025-03-29 Thread Tatsuo Ishii
> Hi, > Patch applies and compiles, all included tests passed and after the latest > fixes for non-nulls array, performance is near to lead/lag without support > of "ignore nulls". > I have been using the last version for more than one month in a production > environment with real data and didn't f

Re: Add RESPECT/IGNORE NULLS and FROM FIRST/LAST options

2025-03-29 Thread Krasiyan Andreev
Hi, Patch applies and compiles, all included tests passed and after the latest fixes for non-nulls array, performance is near to lead/lag without support of "ignore nulls". I have been using the last version for more than one month in a production environment with real data and didn't find any bugs

Re: Add RESPECT/IGNORE NULLS and FROM FIRST/LAST options

2025-03-15 Thread Oliver Ford
On Fri, Feb 28, 2025 at 11:49 AM Tatsuo Ishii wrote: > >> BTW, I noticed that in the code path where > >> ignorenulls_getfuncarginframe() is called, WinSetMarkPosition() is > >> never called? > >> > >> Attached version uses the mark_pos at the end. > > I did simple performance test against v8. >

Re: Add RESPECT/IGNORE NULLS and FROM FIRST/LAST options

2025-03-13 Thread Oliver Ford
On Sun, 9 Mar 2025, 20:07 Oliver Ford, wrote: > On Sun, Mar 9, 2025 at 6:40 AM Tatsuo Ishii wrote: > >> > Attached version removes the non-nulls array. That seems to speed >> > everything up. Running the above query with 1 million rows averages >> 450ms, >> > similar when using lead/lag. >> >>

Re: Add RESPECT/IGNORE NULLS and FROM FIRST/LAST options

2025-03-09 Thread Oliver Ford
On Sun, Mar 9, 2025 at 6:40 AM Tatsuo Ishii wrote: > > Attached version removes the non-nulls array. That seems to speed > > everything up. Running the above query with 1 million rows averages > 450ms, > > similar when using lead/lag. > > Great. However, CFbot complains about the patch: > > http

Re: Add RESPECT/IGNORE NULLS and FROM FIRST/LAST options

2025-03-08 Thread Tatsuo Ishii
> Attached version removes the non-nulls array. That seems to speed > everything up. Running the above query with 1 million rows averages 450ms, > similar when using lead/lag. Great. However, CFbot complains about the patch: https://cirrus-ci.com/task/6364194477441024 Best reagards, -- Tatsuo I

Re: Add RESPECT/IGNORE NULLS and FROM FIRST/LAST options

2025-02-28 Thread Tatsuo Ishii
>> BTW, I noticed that in the code path where >> ignorenulls_getfuncarginframe() is called, WinSetMarkPosition() is >> never called? >> >> Attached version uses the mark_pos at the end. I did simple performance test against v8. EXPLAIN ANALYZE SELECT x, nth_value(x,2) IGNORE NULLS OVER w FROM g

Re: Add RESPECT/IGNORE NULLS and FROM FIRST/LAST options

2025-02-18 Thread Oliver Ford
On Tue, Feb 18, 2025 at 4:19 AM Tatsuo Ishii wrote: > > Attached version doesn't use the nonnulls array if an Exclude is > > specified, as I think it's not going to work with exclusions (as it's > > only an optimization, this is ok and can be taken out entirely if you > > prefer). I've also added

Re: Add RESPECT/IGNORE NULLS and FROM FIRST/LAST options

2025-02-17 Thread Tatsuo Ishii
> Attached version doesn't use the nonnulls array if an Exclude is > specified, as I think it's not going to work with exclusions (as it's > only an optimization, this is ok and can be taken out entirely if you > prefer). I've also added your tests above to the tests. I applied the v7 patch and ra

Re: Add RESPECT/IGNORE NULLS and FROM FIRST/LAST options

2025-02-13 Thread Oliver Ford
On Mon, Feb 3, 2025 at 11:46 AM Tatsuo Ishii wrote: > > > I've looked at it again and I think the code is correct, but I > > miswrote that the array needs to be sorted. The above query returns: > > x | y | nth_value > > ---+---+--- > > 1 | 1 | 2 > > 2 | 2 | 1 > > 3 |

Re: Add RESPECT/IGNORE NULLS and FROM FIRST/LAST options

2025-02-03 Thread Tatsuo Ishii
> I've looked at it again and I think the code is correct, but I > miswrote that the array needs to be sorted. The above query returns: > x | y | nth_value > ---+---+--- > 1 | 1 | 2 > 2 | 2 | 1 > 3 | | 2 > 4 | 4 | > 5 | | 4 > 6 | 6 | 7 > 7

Re: Add RESPECT/IGNORE NULLS and FROM FIRST/LAST options

2025-01-30 Thread Tatsuo Ishii
> I've looked at it again and I think the code is correct, Good news! I will look into your explanation. > but I > miswrote that the array needs to be sorted. The above query returns: > x | y | nth_value > ---+---+--- > 1 | 1 | 2 > 2 | 2 | 1 > 3 | | 2 > 4 |

Re: Add RESPECT/IGNORE NULLS and FROM FIRST/LAST options

2025-01-30 Thread Oliver Ford
On Tue, Jan 28, 2025 at 9:02 AM Tatsuo Ishii wrote: > > >> +/* > >> + * ignorenulls_getfuncarginframe > >> + * For IGNORE NULLS, get the next nonnull value in the frame, moving > >> forward or backward > >> + * until we find a value or reach the frame's end. > >> + */ > >> +static Datum > >> +ign

Re: Add RESPECT/IGNORE NULLS and FROM FIRST/LAST options

2025-01-28 Thread Tatsuo Ishii
>> +/* >> + * ignorenulls_getfuncarginframe >> + * For IGNORE NULLS, get the next nonnull value in the frame, moving >> forward or backward >> + * until we find a value or reach the frame's end. >> + */ >> +static Datum >> +ignorenulls_getfuncarginframe(WindowObject winobj, int argno, >> >> Do you

Re: Add RESPECT/IGNORE NULLS and FROM FIRST/LAST options

2025-01-27 Thread Oliver Ford
On Mon, Jan 27, 2025 at 11:51 AM Tatsuo Ishii wrote: > I have looked through the v5 patch. Here are review comments. New version attached. > @@ -69,6 +69,10 @@ typedef struct WindowObjectData > int readptr;/* tuplestore read > pointer for this fn */ >

Re: Add RESPECT/IGNORE NULLS and FROM FIRST/LAST options

2025-01-27 Thread Tatsuo Ishii
> The attached patch should fix both of these. I've added extra tests > with a PARTITION BY in the window clause to test for multiple > partitions. I have looked through the v5 patch. Here are review comments. >From 5268754b33103fefc511b57ec546103899f70dbe Mon Sep 17 00:00:00 2001 From: Oliver Fo

Re: Add RESPECT/IGNORE NULLS and FROM FIRST/LAST options

2025-01-26 Thread Krasiyan Andreev
Hi, I was able to reproduce exactly the problem, with clean compile and --enable-cassert: 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) test=# Also, make check

Re: Add RESPECT/IGNORE NULLS and FROM FIRST/LAST options

2025-01-24 Thread Oliver Ford
On Thu, Jan 23, 2025 at 6:27 AM Tatsuo Ishii wrote: > > Another possible problem is, probably the code does not work well if > there are multiple partitions. Since win_nonnulls stores currentpos in > a partition, when the partition ends, win_nonnulls needs to be > reset. Otherwise, it mistakenly r

Re: Add RESPECT/IGNORE NULLS and FROM FIRST/LAST options

2025-01-22 Thread Tatsuo Ishii
> Hi, > I was able to reproduce exactly the problem, with clean compile > and --enable-cassert: > 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) >

Re: Add RESPECT/IGNORE NULLS and FROM FIRST/LAST options

2025-01-22 Thread Tatsuo Ishii
> Hello, > I also played with the v4 patch and it produces correct 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 | > 3 | | > (3 rows) > > test=# > It is from today's

Re: Add RESPECT/IGNORE NULLS and FROM FIRST/LAST options

2025-01-22 Thread Tatsuo Ishii
> 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

Re: Add RESPECT/IGNORE NULLS and FROM FIRST/LAST options

2025-01-21 Thread Oliver Ford
On Tue, Jan 21, 2025 at 1:21 AM Tatsuo Ishii wrote: > It needs lots of work including modifying CREATE FUNCTION > command. Instead you could add an API to WinObject access functions to > export ignore_nulls value. Then let each window function check it. If > the window function should not take IGN

Re: Add RESPECT/IGNORE NULLS and FROM FIRST/LAST options

2025-01-20 Thread Tom Lane
Tatsuo Ishii writes: > It needs lots of work including modifying CREATE FUNCTION > command. Instead you could add an API to WinObject access functions to > export ignore_nulls value. Then let each window function check it. If > the window function should not take IGNORE/RESPECT NULLS option, throw

Re: Add RESPECT/IGNORE NULLS and FROM FIRST/LAST options

2025-01-20 Thread Tatsuo Ishii
>> No, there needs to be a way for the individual window function to >> throw error if that's specified for a function that can't handle it. >> I'm just saying I don't want that to be hard-wired in some centralized >> spot. > > Would it be acceptable to add a bool column to pg_proc, say > "pronull

Re: Add RESPECT/IGNORE NULLS and FROM FIRST/LAST options

2025-01-20 Thread Oliver Ford
On Mon, Jan 20, 2025 at 12:31 AM Tom Lane wrote: > > Tatsuo Ishii writes: > >> I would think that > >> IGNORE NULLS is potentially useful for user-defined window functions, > >> and we should not be building anything that restricts the feature to > >> specific functions. > > > So you want to allo

Re: Add RESPECT/IGNORE NULLS and FROM FIRST/LAST options

2025-01-19 Thread Tatsuo Ishii
>> So you want to allow to use IGNORE NULLS to other built-in window >> functions? > > No, there needs to be a way for the individual window function to > throw error if that's specified for a function that can't handle it. > I'm just saying I don't want that to be hard-wired in some centralized >

Re: Add RESPECT/IGNORE NULLS and FROM FIRST/LAST options

2025-01-19 Thread Tom Lane
Tatsuo Ishii writes: >> I would think that >> IGNORE NULLS is potentially useful for user-defined window functions, >> and we should not be building anything that restricts the feature to >> specific functions. > So you want to allow to use IGNORE NULLS to other built-in window > functions? No,

Re: Add RESPECT/IGNORE NULLS and FROM FIRST/LAST options

2025-01-19 Thread Tatsuo Ishii
> Tatsuo Ishii writes: >>> The latest version restricts it to lag, lead, first_value, last_value, >>> and nth_value. We can extend it in a subsequent patch if there's >>> demand? > >> The restriction is required by the SQL standard. So I don't think we >> need to extend to other window functions.

Re: Add RESPECT/IGNORE NULLS and FROM FIRST/LAST options

2025-01-19 Thread Tom Lane
Tatsuo Ishii writes: >> The latest version restricts it to lag, lead, first_value, last_value, >> and nth_value. We can extend it in a subsequent patch if there's >> demand? > The restriction is required by the SQL standard. So I don't think we > need to extend to other window functions. The SQL

Re: Add RESPECT/IGNORE NULLS and FROM FIRST/LAST options

2025-01-19 Thread Tatsuo Ishii
Thanks for updating the patch. >> It seems you allow to use IGNORE NULLS for all window functions. If >> the case, you should explicitely stat that in the docs. Otherwise >> users will be confused because; > > The latest version restricts it to lag, lead, first_value, last_value, > and nth_value.

Re: Add RESPECT/IGNORE NULLS and FROM FIRST/LAST options

2025-01-17 Thread Oliver Ford
On Thu, Sep 12, 2024 at 2:41 AM Tatsuo Ishii wrote: > > It seems you allow to use IGNORE NULLS for all window functions. If > the case, you should explicitely stat that in the docs. Otherwise > users will be confused because; The latest version restricts it to lag, lead, first_value, last_value,

Re: Add RESPECT/IGNORE NULLS and FROM FIRST/LAST options

2024-09-11 Thread Tatsuo Ishii
> On Wednesday, September 11, 2024, Tatsuo Ishii wrote: > >> >> test=# SELECT row_number() IGNORE NULLS OVER w FROM t1 WINDOW w AS (ORDER >> BY i); >> row_number >> >> 1 >> 2 >> (2 rows) >> >> The t1 table only contains NULL rows. By using IGNORE NULLS, I think >

Re: Add RESPECT/IGNORE NULLS and FROM FIRST/LAST options

2024-09-11 Thread David G. Johnston
On Wednesday, September 11, 2024, Tatsuo Ishii wrote: > > test=# SELECT row_number() IGNORE NULLS OVER w FROM t1 WINDOW w AS (ORDER > BY i); > row_number > > 1 > 2 > (2 rows) > > The t1 table only contains NULL rows. By using IGNORE NULLS, I think > it's no wonde

Re: Add RESPECT/IGNORE NULLS and FROM FIRST/LAST options

2024-09-11 Thread Tatsuo Ishii
>> >> On Sat, 6 May 2023, 04:57 Tatsuo Ishii, wrote: >> >>> >> >>> Attached is the patch to implement this (on top of your patch). >> >>> >> >>> test=# SELECT row_number() RESPECT NULLS OVER () FROM (SELECT 1) AS s; >> >>> ERROR: window function row_number cannot have RESPECT NULLS or IGNORE >>

Re: Add RESPECT/IGNORE NULLS and FROM FIRST/LAST options

2024-09-09 Thread Oliver Ford
On Sun, Sep 8, 2024 at 2:22 PM Vik Fearing wrote: > > On 9/7/24 22:25, Oliver Ford wrote: > > On Sat, May 6, 2023 at 9:41 AM Oliver Ford wrote: > >> > >> > >> > >> On Sat, 6 May 2023, 04:57 Tatsuo Ishii, wrote: > >>> > >>> Attached is the patch to implement this (on top of your patch). > >>> > >

Re: Add RESPECT/IGNORE NULLS and FROM FIRST/LAST options

2024-09-08 Thread Vik Fearing
On 9/7/24 22:25, Oliver Ford wrote: On Sat, May 6, 2023 at 9:41 AM Oliver Ford wrote: On Sat, 6 May 2023, 04:57 Tatsuo Ishii, wrote: Attached is the patch to implement this (on top of your patch). test=# SELECT row_number() RESPECT NULLS OVER () FROM (SELECT 1) AS s; ERROR: window funct

Re: Add RESPECT/IGNORE NULLS and FROM FIRST/LAST options

2024-09-07 Thread Oliver Ford
On Sat, May 6, 2023 at 9:41 AM Oliver Ford wrote: > > > > On Sat, 6 May 2023, 04:57 Tatsuo Ishii, wrote: >> >> Attached is the patch to implement this (on top of your patch). >> >> test=# SELECT row_number() RESPECT NULLS OVER () FROM (SELECT 1) AS s; >> ERROR: window function row_number cannot

Re: Add RESPECT/IGNORE NULLS and FROM FIRST/LAST options

2023-05-06 Thread Tatsuo Ishii
> The last time this was discussed ( > https://www.postgresql.org/message-id/1037735.1610402426%40sss.pgh.pa.us) > it was suggested to make the feature generalizable, beyond what the > standard says it should be limited to. I have read the mail. In my understanding nobody said that standard window

Re: Add RESPECT/IGNORE NULLS and FROM FIRST/LAST options

2023-05-06 Thread Oliver Ford
On Sat, 6 May 2023, 04:57 Tatsuo Ishii, wrote: > Attached is the patch to implement this (on top of your patch). > > test=# SELECT row_number() RESPECT NULLS OVER () FROM (SELECT 1) AS s; > ERROR: window function row_number cannot have RESPECT NULLS or IGNORE > NULLS > The last time this was di

Re: Add RESPECT/IGNORE NULLS and FROM FIRST/LAST options

2023-05-05 Thread Tatsuo Ishii
>> The attached test patch is mostly the same as in the previous patch >> set, but it doesn't fail on row_number anymore as the main patch >> only rejects aggregate functions. The test patch also adds a test for > >> +SELECT sum(orbit) RESPECT NULLS OVER () FROM planets; -- succeeds > > I think t

Re: Add RESPECT/IGNORE NULLS and FROM FIRST/LAST options

2023-05-01 Thread Tatsuo Ishii
> The attached test patch is mostly the same as in the previous patch > set, but it doesn't fail on row_number anymore as the main patch > only rejects aggregate functions. The test patch also adds a test for > +SELECT sum(orbit) RESPECT NULLS OVER () FROM planets; -- succeeds I think the standar

Re: Add RESPECT/IGNORE NULLS and FROM FIRST/LAST options

2023-05-01 Thread Oliver Ford
On Sun, Apr 23, 2023 at 4:29 AM Tatsuo Ishii wrote: > > Vik Fearing writes: > > > >> For me, this is perfectly okay. Keep them at the lowest level of > >> reservation as possible. > > > > Yeah, keep them unreserved if at all possible. Any higher reservation > > level risks breaking existing ap

Re: Add RESPECT/IGNORE NULLS and FROM FIRST/LAST options

2023-04-22 Thread Tatsuo Ishii
> Vik Fearing writes: >> On 4/22/23 14:14, Tatsuo Ishii wrote: >>> 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. > >> For me, this is perfectly okay. Keep them at the low

Re: Add RESPECT/IGNORE NULLS and FROM FIRST/LAST options

2023-04-22 Thread Tatsuo Ishii
> 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. In

Re: Add RESPECT/IGNORE NULLS and FROM FIRST/LAST options

2023-04-22 Thread Tom Lane
Vik Fearing writes: > On 4/22/23 14:14, Tatsuo Ishii wrote: >> 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. > For me, this is perfectly okay. Keep them at the lowest level

Re: Add RESPECT/IGNORE NULLS and FROM FIRST/LAST options

2023-04-22 Thread Vik Fearing
On 4/22/23 14:14, Tatsuo Ishii wrote: 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 lov

Re: Add RESPECT/IGNORE NULLS and FROM FIRST/LAST options

2023-04-22 Thread Oliver Ford
On Sat, 22 Apr 2023, 13:14 Tatsuo Ishii, wrote: > 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

Re: Add RESPECT/IGNORE NULLS and FROM FIRST/LAST options

2023-04-22 Thread Tatsuo Ishii
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

Re: Add RESPECT/IGNORE NULLS and FROM FIRST/LAST options

2020-04-30 Thread Krasiyan Andreev
Thank you very much for feedback and yes, that is very useful SQL syntax. Maybe you miss my previous answer, but you are right, that patch is currently dead, because some important design questions must be discussed here, before patch rewriting. I have dropped support of from first/last for nth_va

Re: Add RESPECT/IGNORE NULLS and FROM FIRST/LAST options

2020-04-30 Thread Stephen Frost
Greetings, This seems to have died out, and that's pretty unfortunate because this is awfully useful SQL standard syntax that people look for and wish we had. * Andrew Gierth (and...@tao11.riddles.org.uk) wrote: > So I've tried to rough out a decision tree for the various options on > how this mi

Re: Add RESPECT/IGNORE NULLS and FROM FIRST/LAST options

2018-09-26 Thread Andrew Gierth
> "Krasiyan" == Krasiyan Andreev writes: Krasiyan> I am using last version from more than two months ago in Krasiyan> production environment with real data and I didn't find any Krasiyan> bugs, so I'm marking this patch as ready for committer in the Krasiyan> commitfest app. Oliver (or a

Re: Add RESPECT/IGNORE NULLS and FROM FIRST/LAST options

2018-09-26 Thread Andrew Gierth
> "Tom" == Tom Lane writes: >> So I've tried to rough out a decision tree for the various options >> on how this might be implemented (discarding the "use precedence >> hacks" option). Opinions? Additions? Tom> I think it'd be worth at least drafting an implementation for the Tom> lexic

Re: Add RESPECT/IGNORE NULLS and FROM FIRST/LAST options

2018-09-25 Thread Tom Lane
Andrew Gierth writes: > So I've tried to rough out a decision tree for the various options on > how this might be implemented (discarding the "use precedence hacks" > option). Opinions? Additions? I think it'd be worth at least drafting an implementation for the lexical-lookahead fix. I think it

Re: Add RESPECT/IGNORE NULLS and FROM FIRST/LAST options

2018-09-24 Thread Andrew Gierth
So I've tried to rough out a decision tree for the various options on how this might be implemented (discarding the "use precedence hacks" option). Opinions? Additions? (formatted for emacs outline-mode) * 1. use lexical lookahead +: relatively straightforward parser changes +: no new reserv

Re: Add RESPECT/IGNORE NULLS and FROM FIRST/LAST options

2018-09-23 Thread Andrew Gierth
> "Tom" == Tom Lane writes: >> select nth_value(x) from first ignore; Tom> No, because once IGNORE is a keyword, even unreserved, it's not Tom> legal as an AS-less alias. That rule only applies in the select-list, not in the FROM clause; table aliases in FROM are just ColId, so they can

Re: Add RESPECT/IGNORE NULLS and FROM FIRST/LAST options

2018-09-23 Thread Tom Lane
Andrew Gierth writes: > "Tom" == Tom Lane writes: > Tom> If you just think of recognizing FROM FIRST/LAST, you get nowhere > Tom> because that's still legal in other contexts. But if you were to > Tom> look for FROM followed by FIRST/LAST followed by > Tom> IGNORE/RESPECT/OVER, I think that c

Re: Add RESPECT/IGNORE NULLS and FROM FIRST/LAST options

2018-09-23 Thread Andrew Gierth
> "Tom" == Tom Lane writes: Tom> If you just think of recognizing FROM FIRST/LAST, you get nowhere Tom> because that's still legal in other contexts. But if you were to Tom> look for FROM followed by FIRST/LAST followed by Tom> IGNORE/RESPECT/OVER, I think that could only validly happen i

Re: Add RESPECT/IGNORE NULLS and FROM FIRST/LAST options

2018-09-23 Thread Tom Lane
Andrew Gierth writes: > "Tom" == Tom Lane writes: > Tom> The FROM FIRST/LAST bit seems particularly badly thought through, > Tom> because AFAICS it is flat out ambiguous with a normal FROM clause > Tom> immediately following the window function call. The only way to > Tom> make it not so woul

Re: Add RESPECT/IGNORE NULLS and FROM FIRST/LAST options

2018-09-23 Thread Andrew Gierth
> "Tom" == Tom Lane writes: Tom> The FROM FIRST/LAST bit seems particularly badly thought through, Tom> because AFAICS it is flat out ambiguous with a normal FROM clause Tom> immediately following the window function call. The only way to Tom> make it not so would be to make FIRST and LAS

Re: Add RESPECT/IGNORE NULLS and FROM FIRST/LAST options

2018-09-23 Thread Tom Lane
Andrew Gierth writes: > Normally I'd push hard to try and get some solution that's sufficiently > generic to allow user-defined functions to make use of the feature. But > I think the SQL spec people have managed to make that literally > impossible in this case, what with the FROM keyword appearin

Re: Add RESPECT/IGNORE NULLS and FROM FIRST/LAST options

2018-09-22 Thread Andrew Gierth
> "Krasiyan" == Krasiyan Andreev writes: Krasiyan> Hi, Krasiyan> Patch applies and compiles, all included tests and building Krasiyan> of the docs pass. I am using last version from more than two Krasiyan> months ago in production environment with real data and I Krasiyan> didn't find a

Re: Add RESPECT/IGNORE NULLS and FROM FIRST/LAST options

2018-09-18 Thread Krasiyan Andreev
Hi, Patch applies and compiles, all included tests and building of the docs pass. I am using last version from more than two months ago in production environment with real data and I didn't find any bugs, so I'm marking this patch as ready for committer in the commitfest app. На сб, 28.07.2018 г.

Re: Add RESPECT/IGNORE NULLS and FROM FIRST/LAST options

2018-07-28 Thread David Fetter
On Fri, Jul 13, 2018 at 01:52:00PM +0100, Oliver Ford wrote: > Adds the options RESPECT/IGNORE NULLS (null treatment clause) and FROM > FIRST/LAST to the non-aggregate window functions. Please find attached an updated version for OID drift. Best, David. -- David Fetter http://fetter.org/ Phone:

Add RESPECT/IGNORE NULLS and FROM FIRST/LAST options

2018-07-13 Thread Oliver Ford
Adds the options RESPECT/IGNORE NULLS (null treatment clause) and FROM FIRST/LAST to the non-aggregate window functions. A previous patch (https://www.postgresql.org/message-id/CA+=vxna5_n1q5q5okxc0aqnndbo2ru6gvw+86wk+onsunjd...@mail.gmail.com) partially implemented this feature. However, that pat