Search Postgresql Archives

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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




> On Sep 24, 2022, at 09:04, Barry Kimelman <blkimelman@xxxxxxxxx> 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 try again.  If a row with the same conflict can come from multiple sessions, you'll need to decide how to handle the case that some other session "wins" and inserts the row, and you get a conflict again.







[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux