Re: PostgreSQL::PLPerl::Call - Simple interface for calling SQL functions from PostgreSQL PL/Perl

From: Tim Bunce <Tim(dot)Bunce(at)pobox(dot)com>
To: Richard Huxton <dev(at)archonet(dot)com>
Cc: Tim Bunce <Tim(dot)Bunce(at)pobox(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: PostgreSQL::PLPerl::Call - Simple interface for calling SQL functions from PostgreSQL PL/Perl
Date: 2010-02-15 10:32:28
Message-ID: 20100215103228.GZ373@timac.local
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Feb 15, 2010 at 07:31:14AM +0000, Richard Huxton wrote:
> On 12/02/10 23:10, Tim Bunce wrote:
> >There was some discussion a few weeks ago about inter-stored-procedure
> >calling from PL/Perl.
>
> >I'd greatly appreciate any feedback.
>
> Looks great.

Thanks!

> >PostgreSQL::PLPerl::Call - Simple interface for calling SQL functions from PostgreSQL PL/Perl
>
> I don't think you show an example with an explicit schema name being
> used. Can't hurt to make it obvious.

Yes, good point. I've added one to the docs and tests. Thanks.

> > $seqn = call('nextval(regclass)', $sequence_name);
>
> Is there any value in having a two-stage interface?
>
> $seq_fn = get_call('nextval(regclass)');
> $foo1 = $seq_fn->($seq1);
> $foo2 = $seq_fn->($seq2);

I don't think there's significant performance value in that.

Perhaps it could be useful to be able to pre-curry a call and
then pass that code ref around, but you can do that trivially
already:

$nextval_fn = sub { call('nextval(regclass)', @_) };
$val = $nextval_fn->($seq1);
or
$nextfoo_fn = sub { call('nextval(regclass)', 'foo_seqn') };
$val = $nextfoo_fn->();

Tim.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2010-02-15 10:38:06 Re: idle in txn query cancellation
Previous Message Fujii Masao 2010-02-15 10:18:40 Re: TCP keepalive support for libpq