Re: Foreign Key to Inherited table

Поиск
Список
Период
Сортировка
От Stephan Szabo
Тема Re: Foreign Key to Inherited table
Дата
Msg-id 20031104132006.C67160@megazone.bigpanda.com
обсуждение исходный текст
Ответ на Foreign Key to Inherited table  (Greg Hulands <ghulands@bigpond.net.au>)
Список pgsql-general
On Tue, 4 Nov 2003, Greg Hulands wrote:

> I have a table called Person that has a primary key personID. Another
> table called ProUser that inherits from Person. In another table called
> ProPriceSchedule I have a foreign key constraint to the ProUser table,
> like so: CONSTRAINT proUser FOREIGN KEY (personID) REFERENCES
> ProUser(personID).
>
> The problem I am having is this: ERROR: UNIQUE constraint matching
> given keys for referenced table "prouser" not found

That's because there isn't one. Primary keys, unique constraints and
foreign key constraints don't meaningfully inherit currently.  So, for now
ProUser has no unique constraint on the personID field unless you define
one in ProUser (and said constraint does not prevent a personID in Person
from being duplicated in ProUser).

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

Предыдущее
От: Alexandr S
Дата:
Сообщение: question
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Using SUBSELECT in CHECK expressions