session-1:
vac=> begin;
BEGIN
vac=> lock table t in row share mode;
LOCK TABLE

session-2:
vac=> begin;
BEGIN
vac=> lock table t in row share mode;
LOCK TABLE

session-3:
vac=> begin;
BEGIN
vac=> lock table t in row exclusive mode;
LOCK TABLE

session-1:
vac=> lock table t in share row exclusive mode;
--waiting (conflicts with session-3 lock)

session-2:
vac=> lock table t in share row exclusive mode;
NOTICE:  Deadlock detected -- See the lock(l) manual page for a possible cause.
ERROR:  WaitOnLock: error on wakeup - Aborting this transaction

???

ShareLockExclusive mode doesn't conflict with RowShare mode 
(though it is self-conflicting mode).

Comments in DeadLockCheck() say:
     /*
      * For findlock's wait queue, we are interested in
      * procs who are blocked waiting for a write-lock on
      * the table we are waiting on, and already hold a
      * lock on it. We first check to see if there is an
      * escalation deadlock, where we hold a readlock and
      * want a writelock, and someone else holds readlock
      * on the same table, and wants a writelock.
      *
      * Basically, the test is, "Do we both hold some lock on
      * findlock, and we are both waiting in the lock
      * queue?"   bjm
      */

Unfortunately, this is not right test any more -:(.

Vadim

Sat, 01 May 1999 19:57:00 +0800
Vadim Mikheev <vadim@krs.ru>
DeadLockCheck...