Re: DISCARD ALL ; stored procedures - Mailing list pgsql-hackers

From Robert Haas
Subject Re: DISCARD ALL ; stored procedures
Date
Msg-id AANLkTik1dk7C-mTDemehOmuH0B2iLtqNZrFQcD72ZXoz@mail.gmail.com
Whole thread Raw
In response to Re: DISCARD ALL ; stored procedures  (Stephen Frost <sfrost@snowman.net>)
Responses Re: DISCARD ALL ; stored procedures  (Stephen Frost <sfrost@snowman.net>)
Re: DISCARD ALL ; stored procedures  (Stephen Frost <sfrost@snowman.net>)
List pgsql-hackers
On Fri, Jan 7, 2011 at 1:29 PM, Stephen Frost <sfrost@snowman.net> wrote:
> #1. Add a new 'Top-but-removed-on-DISCARD' context and modify the PLs to
>    use that instead of TopMemoryContext and require any other contexts
>        they create to be children of it.

I'm guessing that just resetting the memory context is going to result
in things breaking all over the place - the PL might have dangling
pointers into the context.  And it might have other resources that we
don't know about.  Thus I think we need:

> #2. Add another entry point to the PLs in pg_pltemplate.h which is a
>    function to be called on DISCARD.

...except I think that the principal thing you need to modify is
pl_language, rather than pl_pltemplate.

If we go this route, then (1) it can't be back-patched, obviously, and
(2) we need to think a little bit harder about what we're asking to
have discarded, because I think it's going to be a lot more than just
cached plans.

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


pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: join functions
Next
From: Dimitri Fontaine
Date:
Subject: Re: obj_unique_identifier(oid)