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

Поиск
Список
Период
Сортировка
От Alex Hunsaker
Тема Re: arrays as pl/perl input arguments [PATCH]
Дата
Msg-id AANLkTikq-Y2=jNx-mVK5GYkgY-xrTOgHQQqy2Qpg9Qti@mail.gmail.com
обсуждение исходный текст
Ответ на Re: arrays as pl/perl input arguments [PATCH]  (Andrew Dunstan <andrew@dunslane.net>)
Список pgsql-hackers
On Fri, Feb 4, 2011 at 10:29, Andrew Dunstan <andrew@dunslane.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.


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Greg Smith
Дата:
Сообщение: Re: Spread checkpoint sync
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Extensions support for pg_dump, patch v27