Thread: PL/Perl trusted throws error on example function

PL/Perl trusted throws error on example function

From
Frank Finner
Date:
Hi,

I tried to test plperl and got the following error with the very first
example from chapter 37:

CREATE OR REPLACE FUNCTION perlmax(integer,integer)
RETURNS integer AS $$
if ($_[0] > $_[1]) { return $_[0]; } return $_[1];
$$ LANGUAGE plperl;

--
error from Perl function: trusted Perl functions disabled - please
upgrade Perl Safe module to version 2.09 or later at (eval 4) line 1.
--

PostgreSQL is 8.0.1, System is SuSE 9.2 (64 bit) on AMD64. Perl Safe
module says, it__s version 2.11, which seems to be the latest release on
CPAN.

plperl is installed as "trusted". If I install it as plperlu
"untrusted", the example above works correctly.

What is so bad with this function that I only can run it untrusted?

Regards, Frank

-- 
Frank Finner

Invenius - Lösungen mit Linux
Köpfchenstraße 36
57072 Siegen
Telefon: 0271 231 8606    Mail: frank.finner@invenius.de
Telefax: 0271 231 8608    Web:  http://www.invenius.de
Key fingerprint = 90DF FF40 582E 6D6B BADF  6E6A A74E 67E4 E788 2651

Attachment

Re: PL/Perl trusted throws error on example function

From
Tom Lane
Date:
Frank Finner <postgresql@finner.de> writes:
> error from Perl function: trusted Perl functions disabled - please
> upgrade Perl Safe module to version 2.09 or later at (eval 4) line 1.

What do you get from
    perl -e 'require Safe; print "$Safe::VERSION\n"'

            regards, tom lane

Re: PL/Perl trusted throws error on example function

From
Frank Finner
Date:
Hi Tom,

I found an error right between my ears,

means, I had looked at the client__s version of Safe, not thinking
about the fact that I was connected to the database on a server which
actually had Safe installed only with version 2.07. I upgraded Safe now
from CPAN on my server and everything works fine now.

Thanks for your help, it opened my eyes.

Regards, Frank



On Thu, 03 Mar 2005 12:14:53 -0500 Tom Lane <tgl@sss.pgh.pa.us> thought
long, then sat down and wrote:

> Frank Finner <postgresql@finner.de> writes:
> > error from Perl function: trusted Perl functions disabled - please
> > upgrade Perl Safe module to version 2.09 or later at (eval 4) line
> > 1.
> 
> What do you get from
>     perl -e 'require Safe; print "$Safe::VERSION\n"'
> 
>             regards, tom lane

-- 
Frank Finner

Invenius - Lösungen mit Linux
Köpfchenstraße 36
57072 Siegen
Telefon: 0271 231 8606    Mail: frank.finner@invenius.de
Telefax: 0271 231 8608    Web:  http://www.invenius.de
Key fingerprint = 90DF FF40 582E 6D6B BADF  6E6A A74E 67E4 E788 2651

Attachment