Re: BUG #1831: plperl gives error after reconnect. - Mailing list pgsql-bugs

From Michael Fuhr
Subject Re: BUG #1831: plperl gives error after reconnect.
Date
Msg-id 20050818020006.GA69240@winnie.fuhr.org
Whole thread Raw
In response to Re: BUG #1831: plperl gives error after reconnect.  (Michael Fuhr <mike@fuhr.org>)
List pgsql-bugs
On Wed, Aug 17, 2005 at 06:49:11PM -0600, Michael Fuhr wrote:
> On Wed, Aug 17, 2005 at 06:46:20PM -0400, Tom Lane wrote:
> > "Greg Sabino Mullane" <greg@turnstep.com> writes:
> > > ERROR:  error from Perl function: creation of Perl function failed:
> > > (in cleanup) Undefined subroutine &main::mksafefunc called at (eval 4) line
> > > 2. at (eval 4) line 2.
> >
> > I could not duplicate this in either 8.0 or HEAD branches.  It looks
> > a bit like an old bug that we had in plperl, though.  Are you sure your
> > plperl.so is up to date?
>
> Could this be another "depends on the junk on your stack" bug?  I
> get different results depending on the OS and version of PostgreSQL:

Also, on my systems the trigger isn't necessary, but the function
call history is significant.  This is in HEAD:

\c test

CREATE OR REPLACE FUNCTION foo() RETURNS text AS $$
return "foo";
$$ LANGUAGE plperl;

CREATE OR REPLACE FUNCTION bar() RETURNS text AS $$
my $rv = spi_exec_query("SELECT foo() AS x");
return $rv->{rows}[0]->{x};
$$ LANGUAGE plperl;

\c test

SELECT bar();
ERROR:  error from Perl function: creation of Perl function failed:     (in cleanup) Undefined subroutine
&main::mksafefunccalled at (eval 5) line 2. at (eval 5) line 2. 

SELECT bar();
ERROR:  error from Perl function: creation of Perl function failed:     (in cleanup) Undefined subroutine
&main::mksafefunccalled at (eval 5) line 2. at (eval 5) line 2. 

SELECT foo();
 foo
-----
 foo
(1 row)

SELECT bar();
 bar
-----
 foo
(1 row)

I verified that the postmaster is using a current plperl.so by
adding a debugging ereport() statement in plperl_call_perl_func()
(output not shown above).

--
Michael Fuhr

pgsql-bugs by date:

Previous
From: Michael Fuhr
Date:
Subject: Re: BUG #1831: plperl gives error after reconnect.
Next
From: Tom Lane
Date:
Subject: Re: BUG #1831: plperl gives error after reconnect.