From: | Greg Stark <gsstark(at)mit(dot)edu> |
---|---|
To: | Jeff Davis <pgsql(at)j-davis(dot)com> |
Cc: | Peter Eisentraut <peter_e(at)gmx(dot)net>, pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: foreign keys for array/period contains relationships |
Date: | 2010-10-26 00:57:54 |
Message-ID: | AANLkTi=1h3=pSB8JCKpsNaT5xt2Kq_QvFEnCrku1yhUT@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Mon, Oct 25, 2010 at 5:24 PM, Jeff Davis <pgsql(at)j-davis(dot)com> wrote:
> I think that's easier when the PK must contain the FK, because then you
> only need to lock one record. Even when you need to lock multiple
> records, it seems feasible, and is just an index lookup, right? Do you
> see a particular problem?
Well if you lock multiple records then it's not clear what operations
you should conflict with. Removing any one of them wouldn't actually
invalidate the foreign key reference unless you remove the last one.
I always assumed this was why we require the unique constraint at all.
Otherwise we could just do a sequential scan and lock all the matching
records. but we would be preventing someone from removing those
records even though removing just one wouldn't be breaking the
constraint.
--
greg
From | Date | Subject | |
---|---|---|---|
Next Message | David E. Wheeler | 2010-10-26 01:02:04 | Re: Composite Types and Function Parameters |
Previous Message | Robert Haas | 2010-10-26 00:38:20 | Re: Range Types, discrete and/or continuous |