On Fri, Jan 7, 2011 at 1:29 PM, Stephen Frost <sfr...@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 -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers