> Robert Haas <robertmhaas@gmail.com> writes:
> > We could do that, but the motivation for the current system was to
> > avoid leaking memory in a long-lived context.
Yeah, my approach here is to use a CATCH block that deletes the memory
context just created, thus avoiding a long-lived leak.
Tom Lane wrote:
> Another key point is to avoid leaving a corrupted relcache entry behind
> if you fail partway through.
Sure ... in the code as I have it we only assign the local variable to
the relcache entry if everything is succesful. So no relcache
corruption should result.
> It might work to build the new key in a context that's initially a
> child of CurrentMemoryContext, then reparent it to be a child of
> CacheMemoryContext when done.
That's another way (than the PG_TRY block), but I think it's more
complicated with no gain.
--
Álvaro Herrera https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers