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

Re: FW: RETURNING in stored procedure

From: Jasen Betts <jasen(at)xnet(dot)co(dot)nz>
To: pgsql-novice(at)postgresql(dot)org
Subject: Re: FW: RETURNING in stored procedure
Date: 2009-05-23 10:22:39
Message-ID: gv8ipf$9hn$ (view raw, whole thread or download thread mbox)
Lists: pgsql-novice
On 2009-05-22, Mehrotra, Abhinav (GE Healthcare) <Abhinav(dot)Mehrotra(at)ge(dot)com> wrote:
> Thanks, this works :) 
> -----Original Message-----
> From: pgsql-novice-owner(at)postgresql(dot)org
> [mailto:pgsql-novice-owner(at)postgresql(dot)org] On Behalf Of Leif B.
> Kristensen
> Sent: Friday, May 22, 2009 2:46 PM
> To: pgsql-novice(at)postgresql(dot)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 ; 

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;


In response to


pgsql-novice by date

Next:From: Leif B. KristensenDate: 2009-05-23 10:41:34
Subject: Re: FW: RETURNING in stored procedure
Previous:From: Alan McKayDate: 2009-05-22 23:33:46
Subject: thanks for an absolutely fantastic #pgcon!

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