Re: Re: can't get UPDATE ... RETURNING ... INTO ... to compile successfully

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Bill Moran <wmoran(at)collaborativefusion(dot)com>
Cc: Dale <harris_da(at)yahoo(dot)com(dot)au>, pgsql-general(at)postgresql(dot)org
Subject: Re: Re: can't get UPDATE ... RETURNING ... INTO ... to compile successfully
Date: 2008-08-19 14:49:09
Message-ID: 20080819144909.GA4428@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Bill Moran wrote:

> Is it possible that your UPDATE command is updating multiple rows? I
> don't believe RETURNING will work on an UPDATE that touches more than 1
> row.

Hmm, why not?

alvherre=> create table bill (a int, b text);
CREATE TABLE
alvherre=> insert into bill values (1, 'one');
INSERT 0 1
alvherre=> insert into bill values (2, 'two');
INSERT 0 1
alvherre=> update bill set b = a || ' ' || b returning b;
b
-------
1 one
2 two
(2 lignes)

UPDATE 2

--
Alvaro Herrera http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Bill Moran 2008-08-19 15:17:52 Re: Re: can't get UPDATE ... RETURNING ... INTO ... to compile successfully
Previous Message Tom Lane 2008-08-19 14:43:50 Re: How to execute 'set session role' from plpgsql function?