Re: arrays as pl/perl input arguments [PATCH]

From: Alexey Klyukin <alexk(at)commandprompt(dot)com>
To: David E(dot) Wheeler <david(at)kineticode(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org, Andrew Dunstan <andrew(at)dunslane(dot)net>
Subject: Re: arrays as pl/perl input arguments [PATCH]
Date: 2011-01-12 13:14:17
Message-ID: 54EEBDFC-FB30-4767-B158-F24EADB90E56@commandprompt.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


On Jan 12, 2011, at 1:07 AM, David E. Wheeler wrote:

> On Jan 11, 2011, at 2:25 PM, Alexey Klyukin wrote:
>
>> Hello,
>>
>> Here's the patch that improves handling of arrays as pl/perl function input
>> arguments, converting postgres arrays of arbitrary dimensions into perl array
>> references.
>
> Awesome! I've wanted this for *years*.
>
>> It includes regression tests and a documentation changes, and it
>> builds and runs successfully on my mac os x and linux boxes. To maintain
>> compatibility with existing pl/perl code a new variable,
>> plperl.convert_array_arguments (better name?), is introduced. Its default
>> value is false, when set to true it triggers the new behavior, i.e.
>
> Have you considered instead passing an array-based object with is string overloading designed to return the pg array string format? That would make for nice, transparent compatibility without the need for a GUC.

You mean packing both a string representation and a reference to a single SV * value?

I haven't considered that (lack of extensive perlgus-foo) although I think that's an interesting idea. One drawback would be that it would require both conversion to a string format and to a perl reference, performing unnecessary actions during every time arrays are passed to a pl/perl function. If there is a strong dislike of the proposed 'compatibility' GUC option - I think I can change the existing patch to incorporate array string representation into the reference-holding SV quite easily.

/A

--
Alexey Klyukin
The PostgreSQL Company - Command Prompt, Inc.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Noah Misch 2011-01-12 13:14:51 Re: ALTER TYPE 1: recheck index-based constraints
Previous Message Alvaro Herrera 2011-01-12 13:07:47 Re: pg_depend explained