Re: [BUGS] BUG #5066: plperl issues with perl_destruct() and END blocks

2009-09-28 Thread Tim Bunce
On Tue, Sep 22, 2009 at 10:13:24AM -0400, Tom Lane wrote: Another point that comes to mind is shared_preload_libraries: if plperl is loaded once in the postmaster, it seems entirely likely that the same END block would be executed in multiple backends after having been loaded only once.

Re: [BUGS] BUG #5066: plperl issues with perl_destruct() and END blocks

2009-09-22 Thread Robert Haas
On Mon, Sep 21, 2009 at 7:30 PM, Tom Lane t...@sss.pgh.pa.us wrote: David Fetter da...@fetter.org writes: On Mon, Sep 21, 2009 at 12:06:30PM -0400, Alvaro Herrera wrote: With connection poolers, backends can last quite awhile.  Is it OK for the END block to run hours after the rest of the

Re: [BUGS] BUG #5066: plperl issues with perl_destruct() and END blocks

2009-09-22 Thread Tom Lane
Robert Haas robertmh...@gmail.com writes: If the changes are simple, as Tim seems to believe, exactly what do we lose by doing this? It's not simple. There are any number of issues that Tim has not addressed. The most obvious: *his* use case might not require database access in an END block,

Re: [BUGS] BUG #5066: plperl issues with perl_destruct() and END blocks

2009-09-22 Thread Robert Haas
On Tue, Sep 22, 2009 at 10:13 AM, Tom Lane t...@sss.pgh.pa.us wrote: Robert Haas robertmh...@gmail.com writes: If the changes are simple, as Tim seems to believe, exactly what do we lose by doing this? It's not simple.  There are any number of issues that Tim has not addressed.  The most

Re: [BUGS] BUG #5066: plperl issues with perl_destruct() and END blocks

2009-09-21 Thread David Fetter
On Mon, Sep 21, 2009 at 11:05:43AM +0100, Tim Bunce wrote: On Sun, Sep 20, 2009 at 10:00:01PM -0400, Alvaro Herrera wrote: There's a definitional problem here however. When should we call the destructor? My impression is that it should happen when the calling query terminates, not when

Re: [BUGS] BUG #5066: plperl issues with perl_destruct() and END blocks

2009-09-21 Thread Alvaro Herrera
David Fetter escribió: Taken literally, that would mean, the last action before the backend exits, but at least to me, that sounds troubling for the same reasons that end of transaction triggers do. What happens when there are two different END blocks in a session? The manual is clear that

Re: [BUGS] BUG #5066: plperl issues with perl_destruct() and END blocks

2009-09-21 Thread David Fetter
On Mon, Sep 21, 2009 at 12:06:30PM -0400, Alvaro Herrera wrote: David Fetter escribió: Taken literally, that would mean, the last action before the backend exits, but at least to me, that sounds troubling for the same reasons that end of transaction triggers do. What happens when there

Re: [BUGS] BUG #5066: plperl issues with perl_destruct() and END blocks

2009-09-21 Thread Alvaro Herrera
David Fetter escribió: On Mon, Sep 21, 2009 at 12:06:30PM -0400, Alvaro Herrera wrote: David Fetter escribió: Taken literally, that would mean, the last action before the backend exits, but at least to me, that sounds troubling for the same reasons that end of transaction triggers

Re: [BUGS] BUG #5066: plperl issues with perl_destruct() and END blocks

2009-09-21 Thread Robert Haas
On Mon, Sep 21, 2009 at 12:06 PM, Alvaro Herrera alvhe...@commandprompt.com wrote: David Fetter escribió: Taken literally, that would mean, the last action before the backend exits, but at least to me, that sounds troubling for the same reasons that end of transaction triggers do.  What

Re: [BUGS] BUG #5066: plperl issues with perl_destruct() and END blocks

2009-09-21 Thread David Fetter
On Mon, Sep 21, 2009 at 01:06:17PM -0400, Alvaro Herrera wrote: David Fetter escribió: On Mon, Sep 21, 2009 at 12:06:30PM -0400, Alvaro Herrera wrote: David Fetter escribió: Taken literally, that would mean, the last action before the backend exits, but at least to me, that

Re: [BUGS] BUG #5066: plperl issues with perl_destruct() and END blocks

2009-09-21 Thread Robert Haas
On Mon, Sep 21, 2009 at 2:17 PM, David Fetter da...@fetter.org wrote: On Mon, Sep 21, 2009 at 01:06:17PM -0400, Alvaro Herrera wrote: David Fetter escribió: On Mon, Sep 21, 2009 at 12:06:30PM -0400, Alvaro Herrera wrote: David Fetter escribió: Taken literally, that would mean, the

Re: [BUGS] BUG #5066: plperl issues with perl_destruct() and END blocks

2009-09-21 Thread David Fetter
On Mon, Sep 21, 2009 at 02:28:11PM -0400, Robert Haas wrote: On Mon, Sep 21, 2009 at 2:17 PM, David Fetter da...@fetter.org wrote: On Mon, Sep 21, 2009 at 01:06:17PM -0400, Alvaro Herrera wrote: David Fetter escribió: On Mon, Sep 21, 2009 at 12:06:30PM -0400, Alvaro Herrera wrote:

Re: [BUGS] BUG #5066: plperl issues with perl_destruct() and END blocks

2009-09-21 Thread Alvaro Herrera
David Fetter escribió: On Mon, Sep 21, 2009 at 01:06:17PM -0400, Alvaro Herrera wrote: The fine manual saith You may have multiple END blocks within a file--they will execute in reverse order of definition; that is: last in, first out (LIFO). But then, why would we

Re: [BUGS] BUG #5066: plperl issues with perl_destruct() and END blocks

2009-09-21 Thread Robert Haas
On Mon, Sep 21, 2009 at 3:08 PM, Alvaro Herrera alvhe...@commandprompt.com wrote: David Fetter escribió: On Mon, Sep 21, 2009 at 01:06:17PM -0400, Alvaro Herrera wrote: The fine manual saith     You may have multiple END blocks within a file--they will     execute in reverse order of

Re: [BUGS] BUG #5066: plperl issues with perl_destruct() and END blocks

2009-09-21 Thread Tom Lane
David Fetter da...@fetter.org writes: On Mon, Sep 21, 2009 at 12:06:30PM -0400, Alvaro Herrera wrote: With connection poolers, backends can last quite awhile. Is it OK for the END block to run hours after the rest of the code? This is an interesting point -- should END blocks be called on

Re: [BUGS] BUG #5066: plperl issues with perl_destruct() and END blocks

2009-09-20 Thread Tim Bunce
On Sat, Sep 19, 2009 at 11:43:26PM -0400, Tom Lane wrote: Robert Haas robertmh...@gmail.com writes: On Sat, Sep 19, 2009 at 3:53 PM, Tom Lane t...@sss.pgh.pa.us wrote: Tim Bunce tim.bu...@pobox.com writes: The plperl implementation doesn't call perl_destruct() during server shutdown.

Re: [BUGS] BUG #5066: plperl issues with perl_destruct() and END blocks

2009-09-20 Thread Alvaro Herrera
There's a definitional problem here however. When should we call the destructor? My impression is that it should happen when the calling query terminates, not when the backend shuts down. I'm sure this will cause other issues -- for example %_SHARED will be destroyed way too early. -- Alvaro

[BUGS] BUG #5066: plperl issues with perl_destruct() and END blocks

2009-09-19 Thread Tim Bunce
The following bug has been logged online: Bug reference: 5066 Logged by: Tim Bunce Email address: tim.bu...@pobox.com PostgreSQL version: 8.4.1 Operating system: darwin Description:plperl issues with perl_destruct() and END blocks Details: The plperl implementation

Re: [BUGS] BUG #5066: plperl issues with perl_destruct() and END blocks

2009-09-19 Thread Tom Lane
Tim Bunce tim.bu...@pobox.com writes: The plperl implementation doesn't call perl_destruct() during server shutdown. Who cares? The process is going away anyway. regards, tom lane -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your

Re: [BUGS] BUG #5066: plperl issues with perl_destruct() and END blocks

2009-09-19 Thread Robert Haas
On Sat, Sep 19, 2009 at 3:53 PM, Tom Lane t...@sss.pgh.pa.us wrote: Tim Bunce tim.bu...@pobox.com writes: The plperl implementation doesn't call perl_destruct() during server shutdown. Who cares?  The process is going away anyway. END {} blocks can execute arbitrary code. Perl users will