Re: DISCARD ALL ; stored procedures

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Stephen Frost <sfrost(at)snowman(dot)net>
Cc: Merlin Moncure <mmoncure(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: DISCARD ALL ; stored procedures
Date: 2011-01-08 11:37:44
Message-ID: AANLkTik1dk7C-mTDemehOmuH0B2iLtqNZrFQcD72ZXoz@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Jan 7, 2011 at 1:29 PM, Stephen Frost <sfrost(at)snowman(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Dimitri Fontaine 2011-01-08 12:14:05 Re: obj_unique_identifier(oid)
Previous Message Robert Haas 2011-01-08 11:04:49 Re: join functions