Re: FW: RETURNING in stored procedure - Mailing list pgsql-novice

From Jasen Betts
Subject Re: FW: RETURNING in stored procedure
Date
Msg-id gv8ipf$9hn$2@reversiblemaps.ath.cx
Whole thread Raw
In response to FW: RETURNING in stored procedure  ("Mehrotra, Abhinav (GE Healthcare)" <Abhinav.Mehrotra@ge.com>)
Responses Re: FW: RETURNING in stored procedure
List pgsql-novice
On 2009-05-22, Mehrotra, Abhinav (GE Healthcare) <Abhinav.Mehrotra@ge.com> wrote:
>
> Thanks, this works :)
>
> -----Original Message-----
> From: pgsql-novice-owner@postgresql.org
> [mailto:pgsql-novice-owner@postgresql.org] On Behalf Of Leif B.
> Kristensen
> Sent: Friday, May 22, 2009 2:46 PM
> To: pgsql-novice@postgresql.org
> Subject: Re: [NOVICE] RETURNING in stored procedure
>
> On Friday 22. May 2009, Mehrotra, Abhinav (GE Healthcare) wrote:
>>Val:= insert into temp("hello") RETURNING seq;

postgres seems to translate anything after a := into a select,
(something I often exploit)

thus you can do

  var := expression FROM table_name WHERE condition_expression ;

etc.

but INSERT-RETURNING isn't treated like an expression, or like a
query so it doesn't work as above.


> INSERT INTO temp("hello") RETURNING seq INTO val;

yeah.



pgsql-novice by date:

Previous
From: Alan McKay
Date:
Subject: thanks for an absolutely fantastic #pgcon!
Next
From: "Leif B. Kristensen"
Date:
Subject: Re: FW: RETURNING in stored procedure