Re: [GENERAL] UPDATE ... ON CONFLICT DO NOTHING - Mailing list pgsql-general

From Alexander Farber
Subject Re: [GENERAL] UPDATE ... ON CONFLICT DO NOTHING
Date
Msg-id CAADeyWgftv-=aHn9fwgReREA5Qp72ocDda5-woMm_mKir2sWUA@mail.gmail.com
Whole thread Raw
In response to Re: [GENERAL] UPDATE ... ON CONFLICT DO NOTHING  (Adrian Klaver <adrian.klaver@aklaver.com>)
Responses Re: [GENERAL] UPDATE ... ON CONFLICT DO NOTHING
List pgsql-general
Yes, Adrian -

On Tue, Mar 14, 2017 at 3:57 PM, Adrian Klaver <adrian.klaver@aklaver.com> wrote:
On 03/14/2017 07:23 AM, Alexander Farber wrote:

in _uids array I have all user ids of player.

I want to merge his or her data, including reviews, to a single user id:
out_uid.

So I make a copy of related words_reviews records (where this user has

Alright I see that you are setting out_uid above the INSERT.
So you are INSERTing rows and if they CONFLICT you leave them alone and have the DELETE remove them, correct?


that is correct and my question is:

copying records for later INSERT ON CONFLICT DO NOTHING seems ineffective to me.

I would prefer to just use UPDATE (for changing "uid" or "author" columns to out_uid value) - but how to handle the conflicts with UPDATE?

Thank you
Alex

P.S. I have just donated 20 Euro to paypal@postgresql.eu

pgsql-general by date:

Previous
From: Glyn Astill
Date:
Subject: Re: [GENERAL] Table not cleaning up drom dead tuples
Next
From: Adrian Klaver
Date:
Subject: Re: [GENERAL] UPDATE ... ON CONFLICT DO NOTHING