Re: UPDATE ... ON CONFLICT DO NOTHING

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Yasin Sari <yasinsari81(at)googlemail(dot)com>
Cc: Alexander Farber <alexander(dot)farber(at)gmail(dot)com>, pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: UPDATE ... ON CONFLICT DO NOTHING
Date: 2017-03-15 17:33:39
Message-ID: CAKFQuwb-XCeQO4gt4p0SGYEAunZugP3T4DBTLsbqUPAo1giZmA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

The convention on these lists is to inline or bottom-post.

On Tue, Mar 14, 2017 at 12:07 PM, Yasin Sari <yasinsari81(at)googlemail(dot)com>
wrote:

> ​​
> Have you tried with inner block and do nothing on exception;
>
>
​I suppose that would work - though using an exception path for expected
logic is messy - and considerably slower than detection.

After doing something like this the OP would then want to DELETE any
remaining records that still have the uid or author with the old value. Do
nothing by itself would just leave them alone.​

> BEGIN
>
> <your code>
> ..............
> BEGIN
>
> UPDATE words_social
> SET uid = out_uid
> WHERE uid = ANY(_uids);
>
> EXCEPTION WHEN OTHERS THEN
> --do nothing or write NULL means do nothing
>
>

​David J.​

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Todd Vitello 2017-03-15 17:35:09 Test to pgsql-general@postgresql.org
Previous Message Stuart Bishop 2017-03-15 09:26:49 Re: Postgres backup solution