Re: Wishlist of PL/Perl Enhancements for PostgreSQL 8.5

From: David Fetter <david(at)fetter(dot)org>
To: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
Cc: Tim Bunce <Tim(dot)Bunce(at)pobox(dot)com>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Wishlist of PL/Perl Enhancements for PostgreSQL 8.5
Date: 2009-10-06 16:18:22
Message-ID: 20091006161822.GC31317@fetter.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, Oct 06, 2009 at 09:34:52AM -0400, Alvaro Herrera wrote:
> David Fetter wrote:
> > On Tue, Oct 06, 2009 at 09:57:39AM +0100, Tim Bunce wrote:
>
> > > * Enable configuration of perl at initialization
> > >
> > > Add ability to specify in postgresql.conf some code to be run
> > > when a perl interpreter is initialized. For example:
> > >
> > > plperl.at_init_do = 'use lib qw(/path/to/mylib); use
> > > MyPlPerlUtils; use List::Util qw(sum);'
> >
> > Would there be some way to integrate this with the per-ROLE,
> > per-database GUC infrastructure?
>
> I don't have that patch installed right now but I don't think it
> would change the current behavior, which is that it should work just
> fine (and if it doesn't, that's a bug).
>
> One thing that's not clear to me is how would this work for
> non-superusers. Wouldn't this violate the Safe containment? If it
> does then it should be superuser-only, no?

Setting it, sure. I was thinking it could be handy for different
roles in different DBs to be able to have different PL/Perls :)

> > > For a PL/Perl function called “foo”, a minimal implementation would use
> > > a name like “foo__id54321″ where 54321 is the oid of the function. This
> > > avoids having to deal with polymorphic functions (where multiple
> > > functions have the same name but different arguments).
> > >
> > > The names won’t enable inter-function calling
> >
> > Inter-function calling could be handy, too.
>
> I agree. This would mean that the function name mangling would have to
> be more predictable ... maybe using the argument types instead of OID?

As Andrew Dunstan pointed out off-list, the argument type naming
scheme is quite vulnerable to naming oddities:

foo(int,text,int)
foo_int(text,int)
foo_int_text(int)
foo_int_text_int()

Cheers,
David.
--
David Fetter <david(at)fetter(dot)org> http://fetter.org/
Phone: +1 415 235 3778 AIM: dfetter666 Yahoo!: dfetter
Skype: davidfetter XMPP: david(dot)fetter(at)gmail(dot)com

Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Richard Huxton 2009-10-06 16:27:46 Re: Wishlist of PL/Perl Enhancements for PostgreSQL 8.5
Previous Message Alvaro Herrera 2009-10-06 16:12:56 Re: attempted to lock invisible tuple - PG 8.4.1