Re: [HACKERS] SHARE locks vs. DELETE in SERIALIZABLE mode (Was: Partitioning/inherited tables vs FKs)

2010-05-11 Thread Florian Pflug
On May 11, 2010, at 20:05 , Jan Wieck wrote: > The problem really is that in the case of deleting a PK row while a > concurrent transaction creates such a reference cannot be solved with user > level visibility rules in case of a serializable transacton, unless you go > really expensive routes.

Re: [HACKERS] SHARE locks vs. DELETE in SERIALIZABLE mode (Was: Partitioning/inherited tables vs FKs)

2010-05-11 Thread Jan Wieck
On 5/11/2010 12:39 PM, Florian Pflug wrote: On May 11, 2010, at 17:04 , Robert Haas wrote: 2010/5/11 Florian Pflug : C1: BEGIN C1: INSERT INTO child (parent_id) VALUES (0) C2: BEGIN C2: SET TRANSACTION ISOLATION LEVEL SERIALIZABLE C2: SELECT TRUE -- Take snapshot *before* C1 commits C1: COMMIT

Re: [HACKERS] SHARE locks vs. DELETE in SERIALIZABLE mode (Was: Partitioning/inherited tables vs FKs)

2010-05-11 Thread Florian Pflug
On May 11, 2010, at 17:04 , Robert Haas wrote: > 2010/5/11 Florian Pflug : >> C1: BEGIN >> C1: INSERT INTO child (parent_id) VALUES (0) >> C2: BEGIN >> C2: SET TRANSACTION ISOLATION LEVEL SERIALIZABLE >> C2: SELECT TRUE -- Take snapshot *before* C1 commits >> C1: COMMIT >> C2: DELETE FROM parent WH

Re: [HACKERS] SHARE locks vs. DELETE in SERIALIZABLE mode (Was: Partitioning/inherited tables vs FKs)

2010-05-11 Thread Kevin Grittner
Florian Pflug wrote: > The serialization error, however, disappears if the two > transactions are swapped. The following sequence of commands > succeeds, even though the FK constraint is not satisfied. > > C1: BEGIN > C1: INSERT INTO child (parent_id) VALUES (0) > C2: BEGIN > C2: SET TRANSACTIO

[HACKERS] SHARE locks vs. DELETE in SERIALIZABLE mode (Was: Partitioning/inherited tables vs FKs)

2010-05-11 Thread Florian Pflug
On May 11, 2010, at 13:29 , Robert Haas wrote: > On Tue, May 11, 2010 at 2:16 AM, Dmitry Fefelov wrote: >>> The referential integrity triggers contain some extra magic that isn't >>> easily simulatable in userland, and that is necessary to make the >>> foreign key constraints airtight. We've disc