Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1ZKj8D-0002j1-Lh for pgsql-bugs@arkaria.postgresql.org; Thu, 30 Jul 2015 08:24:01 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1ZKj8D-0007kR-7n for pgsql-bugs@arkaria.postgresql.org; Thu, 30 Jul 2015 08:24:01 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1ZKj7b-0006vy-1d for pgsql-bugs@postgresql.org; Thu, 30 Jul 2015 08:23:23 +0000 Received: from douglastechnology.co.uk ([109.169.21.47] helo=mail.douglastechnology.co.uk) by makus.postgresql.org with esmtp (Exim 4.84) (envelope-from ) id 1ZKj7U-0001KS-GK for pgsql-bugs@postgresql.org; Thu, 30 Jul 2015 08:23:20 +0000 Received: from redditch (unknown [95.154.250.181]) by mail.douglastechnology.co.uk (Postfix) with ESMTPSA id 4A4174002AB75; Thu, 30 Jul 2015 09:23:12 +0100 (BST) From: "Jack Douglas" To: "'Tom Lane'" Cc: References: <20150728162823.25043.27625@wrigleys.postgresql.org> <17665.1438105627@sss.pgh.pa.us> In-Reply-To: <17665.1438105627@sss.pgh.pa.us> Subject: Re: BUG #13523: Unexplained deadlocks (possible race condition) Date: Thu, 30 Jul 2015 09:23:10 +0100 Message-ID: <015301d0caa0$f868f2f0$e93ad8d0$@douglastechnology.co.uk> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Outlook 15.0 Thread-Index: AQGcf0xE18AKTxoNJZtQsHxZmHenRQIzy08OnkqjFYA= Content-Language: en-gb X-Pg-Spam-Score: -3.3 (---) 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 > There have been discussions of reimplementing SQL-language functions so that parsing occurs one statement at a time, but don't hold your breath about something happening in that direction; it doesn't seem to be a high priority concern for anybody. Perhaps it is worth considering a less drastic change if that is not on the cards in the immediate future? 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. -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs