Re: BUG #8290: broken/unexpected locking behavior - Mailing list pgsql-bugs

From bricklen
Subject Re: BUG #8290: broken/unexpected locking behavior
Date
Msg-id CAGrpgQ-iDqTx_Oz2NTxKRZGhU8W4keRdbnh182Sm9S=DT+gXAA@mail.gmail.com
Whole thread Raw
In response to BUG #8290: broken/unexpected locking behavior  (pgnube@gmail.com)
Responses Re: BUG #8290: broken/unexpected locking behavior  (pg noob <pgnube@gmail.com>)
List pgsql-bugs
On Tue, Jul 9, 2013 at 9:02 AM, <pgnube@gmail.com> wrote:

> The following bug has been logged on the website:
>
> Bug reference:      8290
> Logged by:          pgnoob
> Email address:      pgnube@gmail.com
> PostgreSQL version: 8.4.13
> Operating system:   CentOS Linux
> Description:
>
> I experienced a db deadlock.  After tracking down the problem I attributed
> it to some unusual locking behavior in postgresql where it acquires locks
> in
> an unexpected way that contributed to the deadlock.
>
>
> ALTER TABLE B ADD CONSTRAINT fkrefa FOREIGN KEY (a_id) REFERENCES A(id)
> MATCH FULL;
>

Try those steps again with the FK "DEFERRABLE INITIALLY DEFERRED"
Eg.
ALTER TABLE B ADD CONSTRAINT fkrefa FOREIGN KEY (a_id) REFERENCES A(id)
MATCH FULL deferrable initially deferred;

pgsql-bugs by date:

Previous
From: pgnube@gmail.com
Date:
Subject: BUG #8290: broken/unexpected locking behavior
Next
From: pg noob
Date:
Subject: Re: BUG #8290: broken/unexpected locking behavior