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 12:03:13
Message-ID: 20100215120313.GD373@timac.local
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Feb 15, 2010 at 10:42:15AM +0000, Richard Huxton wrote:
> On 15/02/10 10:32, Tim Bunce wrote:
> >On Mon, Feb 15, 2010 at 07:31:14AM +0000, Richard Huxton wrote:
> >>
> >>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->();
>
> Fair enough. Just wondered whether it was worth putting that on your
> side of the interface. I'm forced to concede you probably have more
> experience in database-related APIs than me :-)

I've actually very little experience with PostgreSQL! I'm happy to argue
each case on its merits and am certainly open to education and persuasion.

At the moment I don't see enough gain to warrant an additional API.
I am adding the some examples to the docs though. So thanks for that!

Tim.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Rémi Zara 2010-02-15 12:26:45 Re: Regression failure on pika caused by CLUSTER rewrite
Previous Message Andres Freund 2010-02-15 12:01:46 Re: [COMMITTERS] pgsql: Speed up CREATE DATABASE by deferring the fsyncs until after