Re: Limitations in PL/perl - Mailing list pgsql-general

From Joe Conway
Subject Re: Limitations in PL/perl
Date
Msg-id 3E77FF14.3080607@joeconway.com
Whole thread Raw
In response to Limitations in PL/perl  (Josh Berkus <josh@agliodbs.com>)
List 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


pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Division of intervals.
Next
From: James Gregory
Date:
Subject: retrieving fields in plpgsql