Re: Per row status during INSERT .. ON CONFLICT UPDATE? - Mailing list pgsql-hackers

From Robins Tharakan
Subject Re: Per row status during INSERT .. ON CONFLICT UPDATE?
Date
Msg-id CAEP4nAyFfgLm=9sx+93LPrqd41ODenuYjip0eiTJ6kGHAYQ70g@mail.gmail.com
Whole thread Raw
In response to Re: Per row status during INSERT .. ON CONFLICT UPDATE?  (Peter Geoghegan <pg@heroku.com>)
Responses Re: Per row status during INSERT .. ON CONFLICT UPDATE?  (Peter Geoghegan <pg@heroku.com>)
List pgsql-hackers

On 19 May 2015 at 23:24, Peter Geoghegan <pg@heroku.com> wrote:
That's certainly something we talked about. It could probably be done
with some kind of magical expression. I have to wonder how many of the
people that are sure that they need this really do, though. Is it
really natural to care about this distinction with idiomatic usage?

Thanks everyone for responding promptly.

​Not sure if I can be authoritative for many, but for me, the need emanates from having to move an ETL off MSSQL Server, which supports OUTPUT $action (similar to RETURNING * in Postgres​) where $action is the per-row status (INSERT / UPDATE).

My use-case is to create an extra row for all UPDATEd rows (only), which is implemented in MSSQL by enveloping the MERGE with an INSERT (MERGE ... OUTPUT $action) WHERE $action = 'UPDATE'. 

Am still to test, but looks like Thom's reply earlier could take care of my use-case, so we may need more people requesting this magic field, with a valid use-case.

--
Robins Tharakan

pgsql-hackers by date:

Previous
From: Geoff Winkless
Date:
Subject: Re: INSERT ... ON CONFLICT DO UPDATE with _any_ constraint
Next
From: Peter Geoghegan
Date:
Subject: Re: INSERT ... ON CONFLICT DO UPDATE with _any_ constraint