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

From: Alex Hunsaker <badalex(at)gmail(dot)com>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: Alexey Klyukin <alexk(at)commandprompt(dot)com>, "David E(dot) Wheeler" <david(at)kineticode(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: arrays as pl/perl input arguments [PATCH]
Date: 2011-02-04 18:43:34
Message-ID: AANLkTikq-Y2=jNx-mVK5GYkgY-xrTOgHQQqy2Qpg9Qti@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Feb 4, 2011 at 10:29, Andrew Dunstan <andrew(at)dunslane(dot)net> wrote:
>> Anyone object to fixing the above as part of this patch? That is
>> making plperl_(build_tuple_result, modify_tuple, return_next,
>> hash_from_tuple) handle array and hash (composite/row) types
>> consistently? And _that_ would be to recurse and turn them from/into
>> perl objects. Thoughts?
>>
>
>
> I have no objection to making the whole thing work recursively, in
> principle, but will it break legacy code?

It will certainly change how nested composites are represented on the
'input side'. I would argue its a bug the way it is now and also
violates the POLA. I think we should also remain backwards compatible
on the output side so you could still return a string:

-- how things are currently, manually assigning a composite-literal
(would continue to work)
=> create or replace function trigger_func() returns trigger as $$
$_TD->{'new'}{'nested_composite'} = {'a'=>'(1,2)'}';
return 'MODIFY';

-- it would also work with perl nested structures (currently broken)
=> create or replace function trigger_func() returns trigger as $$
$_TD->{'new'}{'nested_composite'} = {'a'=>{'b'=>1, 'c'=>2}};
return 'MODIFY';
$$

Or perhaps you are saying we should do something similar with what we
now do with arrays? The pseudo array dance that is.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2011-02-04 18:45:51 Re: Extensions support for pg_dump, patch v27
Previous Message Greg Smith 2011-02-04 18:43:23 Re: Spread checkpoint sync