Re: [GENERAL] Deadlock with single update statement? - Mailing list pgsql-general

From Tom Lane
Subject Re: [GENERAL] Deadlock with single update statement?
Date
Msg-id 8292.1497122186@sss.pgh.pa.us
Whole thread Raw
In response to Re: [GENERAL] Deadlock with single update statement?  (Rob Nikander <rob.nikander@gmail.com>)
Responses Re: [GENERAL] Deadlock with single update statement?  (Justin Pryzby <pryzby@telsasoft.com>)
List pgsql-general
Rob Nikander <rob.nikander@gmail.com> writes:
>> On Jun 10, 2017, at 10:34 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> […] but it'd be better to adjust the query to ensure a deterministic
>> update order.

> Thank you for the answer. Since `update` has no `order by` clause, I’m guessing there’s no way to do this with just
the`update` statement, and that I should use `select … order by … for update’ for this. 

Yeah, that's one easy answer.  You can probably force it with a sub-select
in the UPDATE, as well, but it will take more thought.

            regards, tom lane


pgsql-general by date:

Previous
From: Rob Nikander
Date:
Subject: Re: [GENERAL] Deadlock with single update statement?
Next
From: Justin Pryzby
Date:
Subject: Re: [GENERAL] Deadlock with single update statement?