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

David E. Wheeler <david@kineticode.com>

From: "David E. Wheeler" <david@kineticode.com>
To: Tim Bunce <Tim.Bunce@pobox.com>
Cc: pgsql-hackers@postgresql.org
Date: 2010-02-13T22:25:48Z
Lists: pgsql-hackers
On Feb 12, 2010, at 3:10 PM, Tim Bunce wrote:

> I've appended the POD documentation and attached the (rough but working)
> test script.
> 
> I plan to release the module to CPAN in the next week or so.
> 
> I'd greatly appreciate any feedback.

I like the idea overall, and anything that can simplify the interface is more than welcome. However:

* I'd rather not have to specify a signature for a non-polymorphic function.
* I'd like to be able to use Perl code to call the functions as discussed
  previously, something like:

      my $count_sql = SP->tl_activity_stats_sql(
          [ statistic => $stat, person_id => $pid ],
          $debug
      );

  For a Polymorphic function, perhaps it could be something like:

      my $count = SP->call(
          tl_activity_stats_sql => [qw(text[] int)],
          [ statistic => $stat, person_id => $pid ],
          $debug
      );

  The advantage here is that I'm not writing functions inside strings, and only provide the signature when I need to disambiguate between polymorphic variants.

Anyway, That's just interface arguing. The overall idea is sound and very much appreciated.

Best,

David