From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Sylvain Déve <sylvain(dot)deve(at)protonmail(dot)com> |
Cc: | "pgsql-general(at)lists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org> |
Subject: | Re: Update concurrency |
Date: | 2021-12-20 15:07:37 |
Message-ID: | 2377043.1640012857@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
=?utf-8?Q?Sylvain_D=C3=A9ve?= <sylvain(dot)deve(at)protonmail(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2021-12-20 16:38:43 | Re: Update concurrency |
Previous Message | Christoph Moench-Tegeder | 2021-12-20 14:22:31 | Re: md5 issues Postgres14 on OL7 |