Re: "deadlock detected" documentation

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Matt Mello <alien(at)spaceship(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: "deadlock detected" documentation
Date: 2003-05-15 13:00:25
Message-ID: 7737.1053003625@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Matt Mello <alien(at)spaceship(dot)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

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Martin Marques 2003-05-15 13:48:20 comparing 2 queries
Previous Message edouard.boucher 2003-05-15 12:20:01 check with select