Re: problem with on conflict / do update using psql 14.4

Поиск
Список
Период
Сортировка
От Christophe Pettus
Тема Re: problem with on conflict / do update using psql 14.4
Дата
Msg-id 1E5122A4-E58F-40C3-B579-A0BBD8FFE065@thebuild.com
обсуждение исходный текст
Ответ на Re: problem with on conflict / do update using psql 14.4  (Barry Kimelman <blkimelman@gmail.com>)
Список pgsql-general

> On Sep 24, 2022, at 09:04, Barry Kimelman <blkimelman@gmail.com> wrote:
> Unfortunately, that is exactly what I need to do, I need to modify the data on the 2nd request so that it also gets
inserted.

The best approach is to optimistically insert the row, catch the error if there's a conflict, and modify the data and
tryagain.  If a row with the same conflict can come from multiple sessions, you'll need to decide how to handle the
casethat some other session "wins" and inserts the row, and you get a conflict again. 




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

Предыдущее
От: Barry Kimelman
Дата:
Сообщение: Re: problem with on conflict / do update using psql 14.4
Следующее
От: "David G. Johnston"
Дата:
Сообщение: Re: problem with on conflict / do update using psql 14.4