X-Original-To: pgsql-sql@postgresql.org Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id B846C47653F for ; Thu, 15 May 2003 16:11:55 -0400 (EDT) Received: from postgresql.org ([64.49.215.8]) by localhost (postgresql.org [64.49.215.8:10024]) (amavisd-new) with ESMTP id 02539-04 for ; Thu, 15 May 2003 16:11:24 -0400 (EDT) Received: from ms-smtp-02.texas.rr.com (ms-smtp-02.texas.rr.com [24.93.36.230]) by postgresql.org (Postfix) with ESMTP id 9DE9A476AF3 for ; Thu, 15 May 2003 15:06:36 -0400 (EDT) Received: from spaceship.com (cs24243211-239.austin.rr.com [24.243.211.239]) by ms-smtp-02.texas.rr.com (8.12.5/8.12.2) with ESMTP id h4FJ6anV012184; Thu, 15 May 2003 14:06:37 -0500 (CDT) Message-ID: <3EC3E53C.9070800@spaceship.com> Date: Thu, 15 May 2003 14:06:36 -0500 From: Matt Mello User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4a) Gecko/20030401 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Tom Lane Cc: pgsql-sql@postgresql.org Subject: Re: "deadlock detected" documentation References: <3EB82DA1.7020809@spaceship.com> <24809.1052282819@sss.pgh.pa.us> <3EC32935.5040005@spaceship.com> <7737.1053003625@sss.pgh.pa.us> <3EC3C239.7070708@spaceship.com> <10096.1053017383@sss.pgh.pa.us> <3EC3C77A.3010006@spaceship.com> <10286.1053018824@sss.pgh.pa.us> In-Reply-To: <10286.1053018824@sss.pgh.pa.us> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new X-Archive-Number: 200305/335 X-Sequence-Number: 13500 Okay, so one last question on this... If I do the following, assuming I haven't applied the patch, will it still result in a deadlock (in other words, does this only happen with multi-record updates, or can it happen with independent single-record updates inside transactions)? THREAD1: THREAD2: BEGIN; update txn set ... where txn.terminalid = 1; BEGIN; update txn set ... where txn.terminalid = 2; (I anticipate the next statement will give me a deadlock.) update txn set ... where txn.terminalid = 2; update txn set ... where txn.terminalid = 1; COMMIT; COMMIT; Thanks, again! Tom Lane wrote: > Matt Mello writes: > >>I see. One item I forgot to mention ... Both update statements have a >>where clause containing txn.terminalid=38. Txn.terminalid is a foreign >>key column in that table (txn.terminalid->terminal.terminalid). Could >>this be the source of the trouble? > > > Not per se. The problem depends on which rows get updated and in what > sequence --- the contents of the WHERE clause aren't the issue, except > insofar as they determine the set of rows to be updated. > > regards, tom lane > > -- Matt Mello 512-350-6900