=?utf-8?Q?Sylvain_D=C3=A9ve?= <sylvain.deve@xxxxxxxxxxxxxx> 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