Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1ZKjMj-0003R9-Qc for pgsql-bugs@arkaria.postgresql.org; Thu, 30 Jul 2015 08:39:01 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1ZKjMi-0000Tw-J9 for pgsql-bugs@arkaria.postgresql.org; Thu, 30 Jul 2015 08:39:00 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1ZKjM5-0008ED-KD for pgsql-bugs@postgresql.org; Thu, 30 Jul 2015 08:38:21 +0000 Received: from mail.anarazel.de ([217.115.131.40]) by magus.postgresql.org with esmtp (Exim 4.84) (envelope-from ) id 1ZKjM2-0003vJ-IQ for pgsql-bugs@postgresql.org; Thu, 30 Jul 2015 08:38:20 +0000 Received: from intern.anarazel.de (unknown [46.196.250.227]) (Authenticated sender: andres@anarazel.de) by mail.anarazel.de (Postfix) with ESMTPSA id E258C860003; Thu, 30 Jul 2015 10:38:16 +0200 (CEST) Date: Thu, 30 Jul 2015 10:38:05 +0200 From: Andres Freund To: Jack Douglas Cc: 'Tom Lane' , pgsql-bugs@postgresql.org Subject: Re: BUG #13523: Unexplained deadlocks (possible race condition) Message-ID: <20150730083805.GA3161@alap3.anarazel.de> References: <20150728162823.25043.27625@wrigleys.postgresql.org> <17665.1438105627@sss.pgh.pa.us> <015301d0caa0$f868f2f0$e93ad8d0$@douglastechnology.co.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <015301d0caa0$f868f2f0$e93ad8d0$@douglastechnology.co.uk> X-Pg-Spam-Score: -5.6 (-----) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org On 2015-07-30 09:23:10 +0100, Jack Douglas wrote: > If parsing the INSERT aquires the RowExclusiveLock, perhaps parsing the LOCK > statement should also aquire the lock? That would mean the following > principle in the documentation ("...The best defense against deadlocks is > generally to avoid them by being certain that all applications using a > database acquire locks on multiple objects in a consistent order...", > http://www.postgresql.org/docs/9.4/static/explicit-locking.html#LOCKING-DEAD > LOCKS) would be possible (or at least more easily understood) when using > SQL-language functions. I don't think that'd help at all? The problem here is the lock upgrade from RowExclusiveLock to the exclusive lock, and that'll not be fixed by that proposal? Regards, Andres -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs