X-Original-To: pgsql-sql@postgresql.org Received: from localhost (unknown [64.117.224.193]) by developer.postgresql.org (Postfix) with ESMTP id AB8EB924E1F for ; Mon, 19 May 2003 18:15:38 -0400 (EDT) Received: from developer.postgresql.org ([64.117.224.193]) by localhost (developer.postgresql.org [64.117.224.193:10024]) (amavisd-new) with ESMTP id 37314-05 for ; Mon, 19 May 2003 18:15:28 -0400 (EDT) Received: from ms-smtp-02.texas.rr.com (ms-smtp-02.texas.rr.com [24.93.36.230]) by developer.postgresql.org (Postfix) with ESMTP id 8D961925A57 for ; Mon, 19 May 2003 16:55:09 -0400 (EDT) Received: from spaceship.com (cs24243223-175.austin.rr.com [24.243.223.175]) by ms-smtp-02.texas.rr.com (8.12.5/8.12.2) with ESMTP id h4JKt8nV006837; Mon, 19 May 2003 15:55:08 -0500 (CDT) Message-ID: <3EC944A9.1080404@spaceship.com> Date: Mon, 19 May 2003 15:55:05 -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: Jan Wieck Cc: Tom Lane , pgsql-sql@postgresql.org Subject: Re: "deadlock detected" / cascading locks 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> <28936.1053112428@sss.pgh.pa.us> <3EC92E3F.6080703@Yahoo.com> In-Reply-To: <3EC92E3F.6080703@Yahoo.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new X-Archive-Number: 200305/368 X-Sequence-Number: 13533 Jan, can you explain more to a newby like me what you mean by "the sessions set deferred modes differently?" And, do these locks cascade? If I choose to do an update on table A, and it has a foreign key to table B, which has a foreign key to table C, does the update-induced lock on A cause a lock on B /and/ C? My entire system is setup with foreign keys. Almost all of my tables are part of a "tree" of foreign keys, which can all be traced back to one root table. If a lock on a leaf table causes locks all the way back to the root table, then foreign keys can't be used in my system (and it seems they wouldn't be useful in many other systems ... where this also true). However, if the recent FK-lock bug fix stops this unnecessary locking, things should work well, I guess. I have built and installed the 7.3STABLE tip, but not tested this situation yet. Thanks again! Jan Wieck wrote: > Tom Lane wrote: > >> 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. > > > Except the sessions set deferred modes differently. > > > Jan > -- Matt Mello