From: Tom Lane <tgl@sss.pgh.pa.us>
To: abcxiaod@126.com
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #16820: PG will have a deadlock when multiple rows are updated concurrently
Date: Wed, 13 Jan 2021 11:26:39 -0500
Message-ID: <1283728.1610555199@sss.pgh.pa.us> (raw)
In-Reply-To: <16820-2f08e0bd1687ee34@postgresql.org>
References: <16820-2f08e0bd1687ee34@postgresql.org>
PG Bug reporting form <noreply@postgresql.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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-bugs@postgresql.org
Cc: tgl@sss.pgh.pa.us, abcxiaod@126.com, pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #16820: PG will have a deadlock when multiple rows are updated concurrently
In-Reply-To: <1283728.1610555199@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox