Re: referential Integrity and SHARE locks

From: Marc Munro <marc(at)bloodnok(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: referential Integrity and SHARE locks
Date: 2007-02-08 16:34:14
Message-ID: 1170952454.21038.17.camel@bloodnok.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Oops, forgot to include pgsql-hackers when I responded to this the first
time.

On Tue, 2007-06-02 at 20:53 -0500, Tom Lane wrote:
> Marc Munro <marc(at)bloodnok(dot)com> writes:
> > The RI triggers currently fire when a record is updated. Under my
> > proposal they would fire in the same way but before the record is
locked
> > rather than after. Or am I missing your point?
>
> IOW, some other transaction could update or delete the tuple
meanwhile?
> Doesn't seem very promising.
>

That other transaction, T1, would have run the same RI triggers and so
would have the same parent records locked. The blocked transaction, T2,
once T1 has committed, would fail.

I don't see this as being much different from the current case, where T1
locks and deletes or updates a row, and T2 then tries to manipulate the
same row. In both cases, locks manage the race for the row, and MVCC
ensures that T2 fails.

__
Marc

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2007-02-08 16:38:34 Re: [pgsql-patches] Phantom Command IDs, updated patch
Previous Message Gavin Sherry 2007-02-08 16:28:25 Re: Bitmap index thoughts