I am attempting to solve a problem explained in another question here. On Debian 7.4 with Postgres 9.1.12, I am able to use the Perl
qr operator just fine. On Solaris 5.11 with Postgres 9.2.4, however, I am not able to.
As detailed in the question above, the following stored procedure fails on the Solaris installation:
REATE FUNCTION foo(VARCHAR) RETURNS VARCHAR AS $$ my ( $re ) = @_; $re = ''.qr/\b($re)\b/i; return $re; $$ LANGUAGE plperl;
With the following error:
ERROR: Unable to load utf8.pm into plperl at line 3. BEGIN failed--compilation aborted. CONTEXT: PL/Perl function "foo"
It is apparent that in the Debian installation of Postgres, 'utf8' is already loaded by default. I ran the following stored procedure on both systems:
CREATE FUNCTION perl_modules() RETURNS VOID AS $$ warn join(', ',sort keys %INC); $$ LANGUAGE plperl;
On the Debian system:
WARNING: Carp.pm, Carp/Heavy.pm, Exporter.pm, feature.pm, overload.pm, strict.pm, unicore/Heavy.pl, unicore/To/Fold.pl, utf8.pm, utf8_heavy.pl, vars.pm, warnings.pm, warnings/register.pm at line 2.
On the Solaris system:
WARNING: Carp.pm, Carp/Heavy.pm, Exporter.pm, feature.pm, overload.pm, overloading.pm, strict.pm, vars.pm, warnings.pm, warnings/register.pm at line 2.
I tried to load the
utf8 module on the Solaris system by adding this to the postgres config file:
plperl.on_init = 'use utf8; use re;'
And that successfully loads the
re modules, as shown here:
WARNING: Carp.pm, Carp/Heavy.pm, Exporter.pm, XSLoader.pm, feature.pm, overload.pm, overloading.pm, re.pm, strict.pm, utf8.pm, vars.pm, warnings.pm, warnings/register.pm at line 2.
foo() stored procedure still fails:
dc=# select foo('foo'); ERROR: Attempt to reload utf8_heavy.pl aborted. Compilation failed in require at /opt/perl-5.18.0/lib/utf8.pm line 17. CONTEXT: PL/Perl function "foo"
What is the secret to successfully loading
utf8, and its dependencies, in this Solaris environment?