Re: Request for Patch Feedback: Lag & Lead Window Functions Can Ignore Nulls - Mailing list pgsql-hackers

From Nicholas White
Subject Re: Request for Patch Feedback: Lag & Lead Window Functions Can Ignore Nulls
Date
Msg-id CA+=vxNYqLgXiNsa9sP-K4FLmKH+pyR-P=iA72prtuAMf9b_A9g@mail.gmail.com
Whole thread Raw
In response to Re: Request for Patch Feedback: Lag & Lead Window Functions Can Ignore Nulls  (Hitoshi Harada <umi.tanuki@gmail.com>)
Responses Re: Request for Patch Feedback: Lag & Lead Window Functions Can Ignore Nulls  (Jeff Davis <pgsql@j-davis.com>)
Re: Request for Patch Feedback: Lag & Lead Window Functions Can Ignore Nulls  (Alvaro Herrera <alvherre@2ndquadrant.com>)
List pgsql-hackers
Thanks for the feedback.

For the parsing changes, it seems I can either make RESPECT and IGNORE reserved keywords, or add a lookahead to construct synthetic RESPECT NULLS and IGNORE NULLS keywords. The grammar wouldn't compile if RESPECT and IGNORE were just normal unreserved keywords due to ambiguities after a function definition (e.g. select abs(1) respect; - which is currently a valid statement).

I've redone the leadlag function changes to use datumCopy as you suggested. However, I've had to remove the NOT_USED #ifdef around datumFree so I can use it to avoid building up large numbers of copies of Datums in the memory context while a query is executing. I've attached the revised patch...

Thanks -

Nick


On 24 March 2013 03:43, Hitoshi Harada <umi.tanuki@gmail.com> wrote:


On Sat, Mar 23, 2013 at 3:25 PM, Nicholas White <n.j.white@gmail.com> wrote:
Thanks - I've added it here: https://commitfest.postgresql.org/action/patch_view?id=1096 .

I've also attached a revised version that makes IGNORE and RESPECT UNRESERVED keywords (following the pattern of NULLS_FIRST and NULLS_LAST).

Hm, you made another lookahead in base_yylex to make them unreserved -- looks ok, but not sure if there was no way to do it.

You might want to try byref types such as text.  It seems you need to copy the datum to save the value in appropriate memory context.  Also, try to create a view on those expressions.  I don't think it correctly preserves it.

Thanks,
--
Hitoshi Harada

Attachment

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: WIP: index support for regexp search
Next
From: Josh Berkus
Date:
Subject: Re: [PATCH] Exorcise "zero-dimensional" arrays (Was: Re: Should array_length() Return NULL)