Re: "deadlock detected" documentation - Mailing list pgsql-sql

From Tom Lane
Subject Re: "deadlock detected" documentation
Date
Msg-id 7737.1053003625@sss.pgh.pa.us
Whole thread Raw
In response to Re: "deadlock detected" documentation  (Matt Mello <alien@spaceship.com>)
Responses Re: "deadlock detected" documentation  (Matt Mello <alien@spaceship.com>)
List pgsql-sql
Matt Mello <alien@spaceship.com> writes:
>  From what I understand, two UPDATEs are trying to update different 
> fields of the same records at the same time.  Sometimes one of the 
> updates gets this error, sometimes the other.  I can code around it, but 
> I want to be able to prevent this in new situations in the future.

> Here are the updates:
> UPDATE txn
> SET batchid = 19391
> WHERE  txn.terminalid = 38 AND yadayada

> UPDATE txn
> SET drawerid = 50123
> WHERE txn.terminalid = 38 AND yadayada

I can't see a reason for bare UPDATEs of that sort to get deadlocks.
There must be some other factor involved.  Do you have triggers, rules,
or foreign keys on this table?  Other locks being taken in the same
transaction?
        regards, tom lane


pgsql-sql by date:

Previous
From: edouard.boucher@free.fr
Date:
Subject: check with select
Next
From: Martin Marques
Date:
Subject: comparing 2 queries