Re: BUG #16820: PG will have a deadlock when multiple rows are updated concurrently

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: abcxiaod(at)126(dot)com
Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #16820: PG will have a deadlock when multiple rows are updated concurrently
Date: 2021-01-13 16:26:39
Message-ID: 1283728.1610555199@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

PG Bug reporting form <noreply(at)postgresql(dot)org> writes:
> (1) As long as the data of a single update exceeds 1 row, a deadlock will
> occur:
> update zxin_cardcapacity set usecapacity = usecapacity - 2 where a >2;

I see no particular bug here. If you want to have multiple transactions
updating the same rows concurrently, it's up to you to ensure that each
transaction touches the rows in the same order, otherwise of course there
will be a deadlock.

regards, tom lane

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2021-01-13 16:42:06 Re: BUG #16823: Unreachable code
Previous Message PG Bug reporting form 2021-01-13 15:59:50 BUG #16823: Unreachable code