Re: plperl and regexps with accented characters - incompatible?

From: "Greg Sabino Mullane" <greg(at)turnstep(dot)com>
To: pgsql-general(at)postgresql(dot)org
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: plperl and regexps with accented characters - incompatible?
Date: 2007-11-12 16:43:09
Message-ID: e7c1e5796355633ce8255c7ad0c2ef48@biglumber.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers pgsql-patches


-----BEGIN PGP SIGNED MESSAGE-----
Hash: RIPEMD160

hubert depesz lubaczewski writes:
...
> return (shift =~ /[a-z0-9_-]+/i) || 0;
...
> 'require' trapped by operation mask at line 15.
>
> it looks strange - what "require"?

As you guessed, it's trying to do load the utf8 pragma, and failing
as 'require' (and 'use') are not allowed by default: plperl uses the
Safe module to disallow things like 'require Module;'. Unfortunately, the
only way around it on your end is to use plperlu - something I recommend
anyway (for other reasons).

> also - perhaps loading of this particular module should be allowed even in
> plperl? otherwise it requires me to use plperlu for even the simple task of
> regexp matching.

Yes, we might want to consider making utf8 come pre-loaded for plperl. There
is no direct or easy way to do it (we don't have finer-grained control than
the 'require' opcode), but we could probably dial back restrictions,
'use' it, and then reset the Safe container to its defaults. Not sure what
other problems that may cause, however. CCing to hackers for discussion
there.

- --
Greg Sabino Mullane greg(at)turnstep(dot)com
PGP Key: 0x14964AC8 200711121139
http://biglumber.com/x/web?pk=2529DF6AB8F79407E94445B4BC9B906714964AC8
-----BEGIN PGP SIGNATURE-----

iD8DBQFHOIJPvJuQZxSWSsgRA10hAJ996hZYM8KiuziJb/R2QX0HY754bwCg+xZN
kePHNNZbLtRXj6ko8j51waw=
=fw0v
-----END PGP SIGNATURE-----

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message David Fetter 2007-11-12 16:48:29 Re: reverse strpos?
Previous Message Charles Mortell 2007-11-12 16:41:11 update record with two-column primary key

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2007-11-12 16:56:28 Re: [HACKERS] plperl and regexps with accented characters - incompatible?
Previous Message Tom Dunstan 2007-11-12 16:33:03 Re: [hibernate-team] PostgreSQLDialect

Browse pgsql-patches by date

  From Date Subject
Next Message David Fetter 2007-11-12 16:54:44 Re: Hibernate Dialects for PostgreSQL
Previous Message Simon Riggs 2007-11-12 16:22:11 Doc patch to clarify text search example