pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Matt Mello <alien@spaceship.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: "deadlock detected" documentation
Date: Thu, 15 May 2003 09:00:25 -0400
Message-ID: <7737.1053003625@sss.pgh.pa.us> (raw)
In-Reply-To: <3EC32935.5040005@spaceship.com>
References: <3EB82DA1.7020809@spaceship.com>
	<24809.1052282819@sss.pgh.pa.us>
	<3EC32935.5040005@spaceship.com>

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



view thread (13+ messages)  latest in thread

Message-ID: <7737.1053003625@sss.pgh.pa.us>
Permalink:  ../7737.1053003625@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/7737.1053003625@sss.pgh.pa.us

 · 

reply

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-sql@postgresql.org
  Cc: tgl@sss.pgh.pa.us, alien@spaceship.com
  Subject: Re: "deadlock detected" documentation
  In-Reply-To: <7737.1053003625@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