Skip site navigation (1) Skip section navigation (2)

Re: PL/Perl: spi_prepare() and RETURNING

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: David Fetter <david(at)fetter(dot)org>
Cc: PG Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: PL/Perl: spi_prepare() and RETURNING
Date: 2006-08-24 18:49:45
Message-ID: 44EDF4C9.7020208@dunslane.net (view raw or flat)
Thread:
Lists: 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


In response to

pgsql-hackers by date

Next:From: Greg Sabino MullaneDate: 2006-08-24 18:55:11
Subject: Intervals within information_schema
Previous:From: Mark DilgerDate: 2006-08-24 18:44:43
Subject: Re: An Idea for planner hints

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group