From: | Andreas Karlsson <andreas(at)proxel(dot)se> |
---|---|
To: | Peter Geoghegan <pg(at)heroku(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org> |
Cc: | Craig Ringer <craig(at)2ndquadrant(dot)com> |
Subject: | Re: INSERT ... ON CONFLICT {UPDATE | IGNORE} |
Date: | 2014-08-28 14:29:18 |
Message-ID: | 53FF3CBE.3060904@proxel.se |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On 08/28/2014 04:43 AM, Peter Geoghegan wrote:
> -- Nesting within wCTE:
> WITH t AS (
> INSERT INTO z SELECT i, 'insert'
> FROM generate_series(0, 16) i
> ON CONFLICT UPDATE SET v = v || 'update' -- use of
> operators/functions in targetlist
> RETURNING * -- only projects inserted tuples, never updated tuples
> )
> SELECT * FROM t JOIN y ON t.k = y.a ORDER BY a, k;
Personally I would find it surprising if RETURNING did not also return
the updated tuples. In many use cases for upsert the user does not care
if the row was new or not.
What I think would be useful is if all tuples were returned but there
was some way to filter out only the inserted ones.
--
Andreas Karlsson
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2014-08-28 14:30:30 | Re: re-reading SSL certificates during server reload |
Previous Message | Andres Freund | 2014-08-28 14:26:54 | Re: re-reading SSL certificates during server reload |