Re: Lack of Sanity Checking in file 'pctcl.c' for PostgreSQL 9.4.x - Mailing list pgsql-bugs

From Alvaro Herrera
Subject Re: Lack of Sanity Checking in file 'pctcl.c' for PostgreSQL 9.4.x
Date
Msg-id 20150720122928.GM2301@postgresql.org
Whole thread Raw
In response to Re: Lack of Sanity Checking in file 'pctcl.c' for PostgreSQL 9.4.x  (Michael Paquier <michael.paquier@gmail.com>)
Responses Re: Lack of Sanity Checking in file 'pctcl.c' for PostgreSQL 9.4.x  (Michael Paquier <michael.paquier@gmail.com>)
List pgsql-bugs
Michael Paquier wrote:

> > With some additional effort, we could get rid of perm_fmgr_info, at
> > least in pltcl.  (That hack was introduced in a3ed622b63b and
> > 7748e9e7e5a back in 2001 and we never actually fixed it ...)
>
> Yes it seems so, even for plperl and plpython there seem to be some
> room for improvement at quick glance... This looks like a master-only
> change to me though (and I am sure we are on the same page). For
> back-branches something like the previous patch is definitely safer.

Pushed.

All in all, the whole business of memory allocation in pltcl is pretty
nasty.  If people is really interested in pltcl, that should probably be
fixed to avoid memory leaks.  For one thing, the query cache hash is
global to the interpreter, not local to the function; whenever a
function is recompiled, the old SPI_prepared plans linger forever in the
interpreter (for the life of the session).  It would be nicer if those
were tied to the function lifetime.  For this, the hashtable would have
to be moved to the query desc struct.  pltcl_spi_prepare would have to
know the currently executing function desc struct ...

Maybe Bill is interested enough to write a patch?

--
Álvaro Herrera                http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

pgsql-bugs by date:

Previous
From: Spiros Ioannou
Date:
Subject: Lots of stuck queries after upgrade to 9.4, possible race condition
Next
From: Tom Lane
Date:
Subject: Re: [HACKERS] object_classes array is broken, again