Multiple foreign keys on same field

Поиск
Список
Период
Сортировка
От Ciprian Popovici
Тема Multiple foreign keys on same field
Дата
Msg-id 20041214020624.4c9c4011@xxx
обсуждение исходный текст
Ответы Re: Multiple foreign keys on same field
Re: Multiple foreign keys on same field
Список pgsql-general
I'm in a situation where it would be useful to bind a field in a table via
foreign keys to N other tables simultaneously. The table holds a common
type of info which all those other tables use. The many tables refer to the
common table by keeping references to its serial field.

By doing this, I could ensure that when a row in any of the many tables is
deleted or updated, the effect travels to the common table.

So far, I've been successful in defining more than one foreign key on the
same field in the lone table, tied to fields in different tables. (I half
expected it not to work though).

However, it seems that inserting values in the commons table is a
showstopper: it expects that field value to exists not in only one, but in
ALL bound tables simultaneously.

Is it possible to work around this issue? Perhaps by telling it not to
check for such things when rows are inserted in the common table? I expect
that would break the whole referential integrity thingy, but that would be
useful right about now. Really, I don't want the entire referential
integrity thing, I just want the automatic delete/update half.

--
Ciprian Popovici

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Corrupt RTREE index
Следующее
От: Greg Stark
Дата:
Сообщение: Re: Corrupt RTREE index