X-Original-To: pgsql-sql@postgresql.org Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 5653C4766CA for ; Thu, 15 May 2003 09:00:29 -0400 (EDT) Received: from postgresql.org ([64.49.215.8]) by localhost (postgresql.org [64.49.215.8:10024]) (amavisd-new) with ESMTP id 98306-07 for ; Thu, 15 May 2003 09:00:22 -0400 (EDT) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by postgresql.org (Postfix) with ESMTP id 4408F4766B9 for ; Thu, 15 May 2003 09:00:22 -0400 (EDT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.9/8.12.9) with ESMTP id h4FD0PU6007738; Thu, 15 May 2003 09:00:25 -0400 (EDT) To: Matt Mello Cc: pgsql-sql@postgresql.org Subject: Re: "deadlock detected" documentation In-reply-to: <3EC32935.5040005@spaceship.com> References: <3EB82DA1.7020809@spaceship.com> <24809.1052282819@sss.pgh.pa.us> <3EC32935.5040005@spaceship.com> Comments: In-reply-to Matt Mello message dated "Thu, 15 May 2003 00:44:21 -0500" Date: Thu, 15 May 2003 09:00:25 -0400 Message-ID: <7737.1053003625@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new X-Archive-Number: 200305/313 X-Sequence-Number: 13478 Matt Mello 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