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

From Robert Haas
Subject Re: Re: Request for Patch Feedback: Lag & Lead Window Functions Can Ignore Nulls
Date
Msg-id CA+TgmobkYBxF+BHXRgayhV6_Q1nxMdUr8f_WdH2w+JN2EXV=WA@mail.gmail.com
Whole thread Raw
In response to Re: Re: Request for Patch Feedback: Lag & Lead Window Functions Can Ignore Nulls  (Alvaro Herrera <alvherre@2ndquadrant.com>)
Responses Re: Re: Request for Patch Feedback: Lag & Lead Window Functions Can Ignore Nulls
List pgsql-hackers
On Thu, Sep 26, 2013 at 4:20 PM, Alvaro Herrera
<alvherre@2ndquadrant.com> wrote:
> But how do we ensure that the BMS is allocated in a context?  You'd have
> to switch contexts each time you call bms_add_member.  I don't have a
> good answer to this.

The coding of bms_add_member is pretty funky.  Why doesn't it just
repalloc() the input argument if it's not big enough?  If it did that,
the new allocation would be in the same memory context as the original
one, and we'd not need to care about the memory context when adding an
element to an already non-empty set.

But even if we did decide to switch memory contexts on every call, it
would still be much cleaner than this.  It's only three lines of code
(and about as many instructions) to save and restore
CurrentMemoryContext.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company



pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: Extra functionality to createuser
Next
From: Robert Haas
Date:
Subject: Re: INSERT...ON DUPLICATE KEY LOCK FOR UPDATE