Re: PL/Perl: spi_prepare() and RETURNING

Поиск
Список
Период
Сортировка
От Andrew Dunstan
Тема Re: PL/Perl: spi_prepare() and RETURNING
Дата
Msg-id 44EDF4C9.7020208@dunslane.net
обсуждение исходный текст
Ответ на Re: PL/Perl: spi_prepare() and RETURNING  (David Fetter <david@fetter.org>)
Список pgsql-hackers
David Fetter wrote:
> On Thu, Aug 24, 2006 at 11:31:02AM -0700, David Fetter wrote:
>   
>> Folks,
>>
>> I've found a little lacuna in the RETURNING feature, that being in
>> PL/Perl's spi_prepare()/spi_execute_prepared() as illustrated in the
>> attached file on CVS TIP.
>>
>> I think that fixing this is a matter of post-RETURNING-patch cleanup.
>> What else might not know about RETURNING that needs to?
>>
>> Cheers,
>> D
>>     
>
>
> Oops.  This time, with the actual file attached :P
>
>   
> my $foo_id = spi_exec_prepared(
>     $sth,
>     $_[0],
> )->{rows}->[0]->{foo_id};
>
>   

I am not sure that the 'rows' member is the right place for it, even if 
it were returned. For one thing, it should always be an arrayref, but 
overloading the first row like this is ugly.

Maybe 'returned_value' or some such would be better, e.g. $foo_id = 
$result->{returned_value}->{foo_id}

(We can't just stash it in the result hash with the used name in case 
somebody overrides the preexisiting members)

cheers

andrew



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

Предыдущее
От: Bernd Helmle
Дата:
Сообщение: Re: [PATCHES] Updatable views
Следующее
От: Zoltan Boszormenyi
Дата:
Сообщение: Re: [PATCHES] COPY view