Re: Add on_perl_init and proper destruction to plperl [PATCH] - Mailing list pgsql-hackers

From Tim Bunce
Subject Re: Add on_perl_init and proper destruction to plperl [PATCH]
Date
Msg-id 20100128160248.GD38673@timac.local
Whole thread Raw
In response to Re: Add on_perl_init and proper destruction to plperl [PATCH]  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On Thu, Jan 28, 2010 at 10:39:33AM -0500, Tom Lane wrote:
> Tim Bunce <Tim.Bunce@pobox.com> writes:
> > On Wed, Jan 27, 2010 at 06:27:50PM -0500, Tom Lane wrote:
> >> An advantage of on_proc_exit from your end is that it should allow
> >> you to not have to try to prevent the END blocks from using SPI,
> >> as that would still be perfectly functional when your callback
> >> gets called.  (Starting a new transaction would be a good idea
> >> though, cf Async_UnlistenOnExit.)
> 
> > I'm surprised that you're suggesting that END block should be allowed to
> > interact with the backend via SPI.  It seems to go against what you've
> > said previously about code running at shutdown.
> 
> I think you have completely misunderstood what I'm complaining about.
> What I'm not happy about is executing operations at a point where
> they're likely to be ill-defined because the code is in the wrong state.
> In an early on_proc_exit hook, the system is for all practical purposes
> still fully functional, and so I don't see a reason for an arbitrary
> restriction on what the END blocks should be able to do.

Ah, okay. I guess I missed your underlying concerns in:
   http://archives.postgresql.org/message-id/26766.1263149361@sss.pgh.pa.us   For the record, [...] and I think it's a
worseidea to run   arbitrary user-defined code at backend shutdown (the END-blocks bit).
 

> (Or, to repeat myself in a different way: the no-SPI restriction is
> utterly useless to guard against my real concerns anyway.  I see no
> point in it either here or elsewhere.)

I've left it in the updated patch I've just posted.
There are two more plperl patches in the current commitfest that I'd
like to chaperone through to commit (in some form or other) first.

Thanks for your help Tom.

Tim.


pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: Review: listagg aggregate
Next
From: Simon Riggs
Date:
Subject: Re: Streaming replication, and walsender during recovery