X-Original-To: pgsql-sql@postgresql.org Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 5F153476AD9 for ; Fri, 16 May 2003 15:13:50 -0400 (EDT) Received: from postgresql.org ([64.49.215.8]) by localhost (postgresql.org [64.49.215.8:10024]) (amavisd-new) with ESMTP id 32952-07 for ; Fri, 16 May 2003 15:13:48 -0400 (EDT) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by postgresql.org (Postfix) with ESMTP id B1FEE476967 for ; Fri, 16 May 2003 15:13:48 -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 h4GJDmU6028937; Fri, 16 May 2003 15:13:49 -0400 (EDT) To: Matt Mello Cc: pgsql-sql@postgresql.org Subject: Re: "deadlock detected" documentation In-reply-to: <3EC50CEB.9080202@spaceship.com> 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> <3EC3E53C.9070800@spaceship.com> <3EC50CEB.9080202@spaceship.com> Comments: In-reply-to Matt Mello message dated "Fri, 16 May 2003 11:08:11 -0500" Date: Fri, 16 May 2003 15:13:48 -0400 Message-ID: <28936.1053112428@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new X-Archive-Number: 200305/354 X-Sequence-Number: 13519 Matt Mello writes: > The two situations I can think of are: > 1) Two FK fields in a single row pointing to 2 different FK tables, for > which any 2 updates get locks in opposite order (seems like a deadlock). I don't think this is possible, at least in 7.3. All backends are guaranteed to run the triggers of a given table in the same order, so the foreign-row locks should be acquired in the same column order in all cases. > 2) Two FK fields pointing to only 1 FK table (both fields are references > to the same table), for which each update gets independent locks instead > of one lock for both fields, so there is a potential that #1 problem > could impact this as well. Not clear what you mean by "independent locks"; there is only one row lock on a row. The cases that I'd be concerned about are not within-row conflicts, but multi-row conflicts... regards, tom lane