Re: Limitations in PL/perl

From: Joe Conway <mail(at)joeconway(dot)com>
To: josh(at)agliodbs(dot)com
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Limitations in PL/perl
Date: 2003-03-19 05:24:36
Message-ID: 3E77FF14.3080607@joeconway.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Josh Berkus wrote:
> Is there any documentation anywhere on what subset of Perl functionality is
> supported by PL/perl? I've had a lot of annoying trial-and-error sessions
> lately where I'll try something that works on the command line only to find
> out that it silently fails in PL/perl.
[...snip...]
> Or is this maybe a problem with the version of Perl installed on the DB
> server?

I think it is probably a problem with the version of Perl installed on
the DB server. As far as I can see, plperl just runs a perl interpreter
using whatever perl shared library it finds. That is except plperl (as
compared to plperlu) runs a "safe" interpreter with certain
functionality disabled -- but I don't know the details of what is disabled.

I can see this in the source:
plperl_init_interp(void)
{
char *embedding[3] = {
"", "-e",
/*
* no commas between the next 5 please. They are supposed to be
* one string
*/
"require Safe; SPI::bootstrap();"
"sub ::mksafefunc { my $x = new Safe;
$x->permit_only(':default');$x->permit(':base_math');"
"$x->share(qw[&elog &DEBUG &LOG &INFO &NOTICE &WARNING &ERROR]);"
" return $x->reval(qq[sub { $_[0] }]); }"
"sub ::mkunsafefunc {return eval(qq[ sub { $_[0] } ]); }"
};

Not sure if that helps.

Joe

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2003-03-19 05:46:21 Re: retrieving fields in plpgsql
Previous Message Tom Lane 2003-03-19 05:23:16 Re: Division of intervals.