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" <[EMAIL PROTECTED]> 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

---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

               http://www.postgresql.org/docs/faq

Reply via email to