Re: Update concurrency

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Update concurrency
Дата
Msg-id 2377043.1640012857@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Update concurrency  (Sylvain Déve <sylvain.deve@protonmail.com>)
Список pgsql-general
=?utf-8?Q?Sylvain_D=C3=A9ve?= <sylvain.deve@protonmail.com> writes:
>     # JSONB update for a single selected row and column.
>     # 'column' and 'select_row' are determined with the parameters 'data' and 'path'.
>     command = (
>         f"""UPDATE MY_TABLE SET """
>         f"""{column} = jsonb_merge({column}, %s) """
>         f"""WHERE {select_row};"""
>     )

> When called twice in a row, this call leads to the error (at "cur.execute"):
>     psycopg2.errors.InternalError_: tuple concurrently updated

That error should be pretty hard to reach from user code, and certainly
two successive UPDATEs ought not have anything to do with it.  I think
there is something you're not telling us about the context.  Does this
table have any triggers, weird constraints, or the like?  What is the
actual WHERE clause (ie, I wonder if you have simplified away some
relevant query detail)?  What PG version is this exactly?

            regards, tom lane



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

Предыдущее
От: Christoph Moench-Tegeder
Дата:
Сообщение: Re: md5 issues Postgres14 on OL7
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Update concurrency