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

From Nicholas White
Subject Request for Patch Feedback: Lag & Lead Window Functions Can Ignore Nulls
Date
Msg-id CA+=vxNbcnZxDqVg4EX8oqMyFxU5XV2ron-MaE7_PZ8V-W-gDYA@mail.gmail.com
Whole thread Raw
In response to Re: Request for Patch Feedback: Lag & Lead Window Functions Can Ignore Nulls  (Dean Rasheed <dean.a.rasheed@gmail.com>)
Responses Re: Request for Patch Feedback: Lag & Lead Window Functions Can Ignore Nulls
List pgsql-hackers
> pg_get_viewdef() needs to be updated

Ah, good catch - I've fixed this in the attached. I also discovered that there's a parent-child hierarchy of WindowDefs (using relname->name), so instead of cloning the WindowDef (in parse_agg.c) if the frameOptions are different (e.g. by adding the ignore-nulls flag) I create a child of the WindowDef and override the frameOptions. This has the useful side-effect of making pg_get_viewdef work as expected (the previous iteration of the patch produced a copy of the window definintion, not the window name, as it was using a nameless clone), although the output has parentheses around the view name:

> lag(i.i, 2) IGNORE NULLS OVER (w) AS lagged_by_2

I've updated the test cases accordingly. Thanks -

Nick
Attachment

pgsql-hackers by date:

Previous
From: Luis Carvalho
Date:
Subject: PL/Lua (was: plpython implementation)
Next
From: Michael Paquier
Date:
Subject: Re: pg_ctl and -h/help