Neil Conway <neilc@samurai.com> writes:
> /*
> ! * Grab an exclusive lock on the pk table, so that someone doesn't
> ! * delete rows out from under us. (Although a lesser lock would do for
> ! * that purpose, we'll need exclusive lock anyway to add triggers to
> ! * the pk table; trying to start with a lesser lock will just create a
> ! * risk of deadlock.)
> */
> ! pkrel = heap_openrv(fkconstraint->pktable, AccessExclusiveLock);
> /*
> * Validity and permissions checks
> --- 3829,3839 ----
> Oid constrOid;
> /*
> ! * Grab a lock on the pk table, so that someone doesn't delete
> ! * rows out from under us; ShareRowExclusive should be good
> ! * enough.
> */
BTW, the above comment change is seriously inadequate, because it
removes the explanation of *why* that is the minimum required lock.
regards, tom lane