Re: Foreign key reference counting strategy?
| От | Tom Lane |
|---|---|
| Тема | Re: Foreign key reference counting strategy? |
| Дата | |
| Msg-id | 13667.1160871610@sss.pgh.pa.us обсуждение исходный текст |
| Ответ на | Re: Foreign key reference counting strategy? (Michael Fuhr <mike@fuhr.org>) |
| Ответы |
Re: Foreign key reference counting strategy?
|
| Список | pgsql-sql |
Michael Fuhr <mike@fuhr.org> writes:
> On Sat, Oct 14, 2006 at 07:58:06PM -0400, Tom Lane wrote:
>> No, I don't think so, because the DELETE will already be holding
>> exclusive lock on the doomed PK row, which any would-be inserters of
>> matching FK rows will be blocked on. AFAICS the DELETE should go
>> through and then the inserters will fail.
> Unless the inserters got there first. I just tested both ways; if
> the insert acquires the lock first then the delete fails, but if the
> delete acquires the lock first then the insert fails.
Well, if the inserters get a lock on the PK row before the DELETE does,
then of course. I was just disputing the assertion that doing IF EXISTS
in an after trigger would add a new way for the DELETE to fail. At that
point, any uncommitted inserts must be blocked waiting for the delete.
regards, tom lane
В списке pgsql-sql по дате отправления: