Re: BUG #13523: Unexplained deadlocks (possible race condition) - Mailing list pgsql-bugs

From Jack Douglas
Subject Re: BUG #13523: Unexplained deadlocks (possible race condition)
Date
Msg-id 015301d0caa0$f868f2f0$e93ad8d0$@douglastechnology.co.uk
Whole thread Raw
In response to Re: BUG #13523: Unexplained deadlocks (possible race condition)  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: BUG #13523: Unexplained deadlocks (possible race condition)
List pgsql-bugs
> 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.

pgsql-bugs by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: BUG #13525: Database crashed with several error messages "Could not open file "pg_multixact/members/"
Next
From: Andres Freund
Date:
Subject: Re: BUG #13523: Unexplained deadlocks (possible race condition)