Re: plperl.on_init - bug or just me?

Lists: pgsql-hackers
From: Richard Huxton <dev(at)archonet(dot)com>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: plperl.on_init - bug or just me?
Date: 2010-02-25 11:01:20
Message-ID: 4B865880.5060404@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

From memory and the thread below, I thought one of the key uses was to
let me use a module from trusted plperl.
http://archives.postgresql.org/pgsql-hackers/2010-02/msg00167.php

The example below has a TestModule that just exports one sub - visible
from plerlu but not plperl. Presumably "Safe" just clamps down and my
sub isn't marked as acceptable. Is this intended, or am I doing
something stupid?

postgresql.conf:
plperl.on_init =
'use lib "/home/richardh/dev/"; use TestModule qw(add_one);'

-- tries to call TestModule::add_one
richardh=# SELECT add_one(1);
ERROR: Undefined subroutine &TestModule::add_one called at line 1.
CONTEXT: PL/Perl function "add_one"

-- tries to call the exported main::add_one
richardh=# SELECT add_one_e(1);
ERROR: Undefined subroutine &main::add_one called at line 1.
CONTEXT: PL/Perl function "add_one_e"

-- plperlu - TestModule::add_one
richardh=# SELECT add_one_u(1);
add_one_u
-----------
2
(1 row)

--
Richard Huxton
Archonet Ltd


From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Richard Huxton <dev(at)archonet(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: plperl.on_init - bug or just me?
Date: 2010-02-25 17:10:03
Message-ID: 4B86AEEB.3030108@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Richard Huxton wrote:
> From memory and the thread below, I thought one of the key uses was to
> let me use a module from trusted plperl.
> http://archives.postgresql.org/pgsql-hackers/2010-02/msg00167.php
>
> The example below has a TestModule that just exports one sub - visible
> from plerlu but not plperl. Presumably "Safe" just clamps down and my
> sub isn't marked as acceptable. Is this intended, or am I doing
> something stupid?
>
>

It's intended (at least by me).

Also, please see the recent discussion about loading extra stuff into
the Safe container. At the very least that has been shelved for now.
We're going to proceed with deliberation in this area. I'm quite
concerned to make sure that we don't provide an opportunity for people
to undermine the behaviour of the trusted language.

cheers

andrew


From: Richard Huxton <dev(at)archonet(dot)com>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: plperl.on_init - bug or just me?
Date: 2010-02-25 17:14:33
Message-ID: 4B86AFF9.9040609@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On 25/02/10 17:10, Andrew Dunstan wrote:
>
>
> Richard Huxton wrote:
>> Presumably "Safe" just clamps down and my
>> sub isn't marked as acceptable. Is this intended, or am I doing
>> something stupid?
>
> It's intended (at least by me).
>
> Also, please see the recent discussion about loading extra stuff into
> the Safe container.

Ah - looks like I've missed a thread.

> At the very least that has been shelved for now.
> We're going to proceed with deliberation in this area. I'm quite
> concerned to make sure that we don't provide an opportunity for people
> to undermine the behaviour of the trusted language.

Fair enough.

--
Richard Huxton
Archonet Ltd