Re: [GENERAL] UPDATE ... ON CONFLICT DO NOTHING

Поиск
Список
Период
Сортировка
От Yasin Sari
Тема Re: [GENERAL] UPDATE ... ON CONFLICT DO NOTHING
Дата
Msg-id CADhAfgOMA7UkHRKe=ECD0jftT9oyEXzcZWriLQiDFBcKck5QeQ@mail.gmail.com
обсуждение исходный текст
Ответ на Re: [GENERAL] UPDATE ... ON CONFLICT DO NOTHING  (Alexander Farber <alexander.farber@gmail.com>)
Ответы Re: [GENERAL] UPDATE ... ON CONFLICT DO NOTHING  ("David G. Johnston" <david.g.johnston@gmail.com>)
Список pgsql-general
Have you tried with inner block and do nothing on exception;

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
         
         END;

 <your code>
..............

END;

14 Mar 2017 Sal, 19:01 tarihinde, Alexander Farber <alexander.farber@gmail.com> şunu yazdı:
My initial idea has been not to use ON CONFLICT at all, but instead only UPDATE the words_reviews records (set "uid" or "author" to out_uid) for which NO EXISTS already such a record with PK (uid, author)... and then DELETE the rest (as I can't update them without a conflict) but I haven't figured it out yet...

Thank you anyway

В списке pgsql-general по дате отправления:

Предыдущее
От: Adrian Klaver
Дата:
Сообщение: Re: [GENERAL] UPDATE ... ON CONFLICT DO NOTHING
Следующее
От: Lawrence Cohan
Дата:
Сообщение: [GENERAL] Postgres backup solution