Re: BUG #1831: plperl gives error after reconnect.

From: Michael Fuhr <mike(at)fuhr(dot)org>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Greg Sabino Mullane <greg(at)turnstep(dot)com>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #1831: plperl gives error after reconnect.
Date: 2005-08-18 02:00:06
Message-ID: 20050818020006.GA69240@winnie.fuhr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)turnstep(dot)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::mksafefunc called 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::mksafefunc called 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

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2005-08-18 04:26:28 Re: BUG #1831: plperl gives error after reconnect.
Previous Message Michael Fuhr 2005-08-18 00:49:11 Re: BUG #1831: plperl gives error after reconnect.