Re: Add on_perl_init and proper destruction to plperl [PATCH]

From: Tim Bunce <Tim(dot)Bunce(at)pobox(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Tim Bunce <Tim(dot)Bunce(at)pobox(dot)com>, "David E(dot) Wheeler" <david(at)kineticode(dot)com>, Alex Hunsaker <badalex(at)gmail(dot)com>, Andrew Dunstan <andrew(at)dunslane(dot)net>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Add on_perl_init and proper destruction to plperl [PATCH]
Date: 2010-01-28 16:02:48
Message-ID: 20100128160248.GD38673@timac.local
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Jan 28, 2010 at 10:39:33AM -0500, Tom Lane wrote:
> Tim Bunce <Tim(dot)Bunce(at)pobox(dot)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 worse idea 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.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2010-01-28 16:04:37 Re: pgsql: Define INADDR_NONE on Solaris when it's missing.
Previous Message Robert Haas 2010-01-28 16:02:21 Re: Review: listagg aggregate