Re: Multicolumn foreign keys need useless unique indices?

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Multicolumn foreign keys need useless unique indices?
Дата
Msg-id 13816.1032036258@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Multicolumn foreign keys need useless unique indices?  (Hannu Krosing <hannu@tm.ee>)
Список pgsql-hackers
Hannu Krosing <hannu@tm.ee> writes:
> so the index will help us equally for both cases, as it will point to N
> entries of which only one can be alive at a time and which all have to
> be checked.
> It will be only marginally more work to check if the only live entry
> does match the non-index columns.

But the "marginally more work" represents code that does not exist at
all right now, and which there's no really convenient place to add AFAIR.
This seems to me to be going rather out of our way to support a coding
practice that is specifically disallowed by the standard.

Something that no one has bothered to ask, but seems to me relevant,
is exactly why we should consider it important to support foreign keys
of this form?  Aren't we talking about a poor schema design in the first
place, if the referenced column set covers more than just the unique key
of the referenced table?  At the very least this is a violation of
normalization, and so it's inherently inefficient.

> There will probably be additional work if we want to drop the original
> constraint, but this is a separate issue.

It's not separate, because it's more work that we *will* have to do,
to support a feature that is nonstandard and of debatable usefulness.
        regards, tom lane


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

Предыдущее
От: Hannu Krosing
Дата:
Сообщение: Re: DROP TABLE... CASCADE weirdness
Следующее
От: "Michael Paesold"
Дата:
Сообщение: Indexes and differing column types