Re: foreign keys for array/period contains relationships

Поиск
Список
Период
Сортировка
От Greg Stark
Тема Re: foreign keys for array/period contains relationships
Дата
Msg-id AANLkTi=1h3=pSB8JCKpsNaT5xt2Kq_QvFEnCrku1yhUT@mail.gmail.com
обсуждение исходный текст
Ответ на Re: foreign keys for array/period contains relationships  (Jeff Davis <pgsql@j-davis.com>)
Ответы Re: foreign keys for array/period contains relationships  (Peter Eisentraut <peter_e@gmx.net>)
Re: foreign keys for array/period contains relationships  (Jeff Davis <pgsql@j-davis.com>)
Список pgsql-hackers
On Mon, Oct 25, 2010 at 5:24 PM, Jeff Davis <pgsql@j-davis.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


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Robert Haas
Дата:
Сообщение: Re: Range Types, discrete and/or continuous
Следующее
От: "David E. Wheeler"
Дата:
Сообщение: Re: Composite Types and Function Parameters