Re: locks in CREATE TRIGGER, ADD FK - Mailing list pgsql-hackers

From Tom Lane
Subject Re: locks in CREATE TRIGGER, ADD FK
Date
Msg-id 1420.1111550778@sss.pgh.pa.us
Whole thread Raw
In response to Re: locks in CREATE TRIGGER, ADD FK  (Neil Conway <neilc@samurai.com>)
List pgsql-hackers
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


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: locks in CREATE TRIGGER, ADD FK
Next
From: Tom Lane
Date:
Subject: Re: locks in CREATE TRIGGER, ADD FK