Re: inheritance and primary/foreign keys

Поиск
Список
Период
Сортировка
От Einar Karttunen
Тема Re: inheritance and primary/foreign keys
Дата
Msg-id Pine.LNX.4.30.0103090919340.26024-100000@melkinpaasi.cs.Helsinki.FI
обсуждение исходный текст
Ответ на Re: inheritance and primary/foreign keys  (Stephan Szabo <sszabo@megazone23.bigpanda.com>)
Ответы Re: inheritance and primary/foreign keys
Список pgsql-general
On Wed, 7 Mar 2001, Stephan Szabo wrote:
>
> You cannot safely reference tops of inheritance trees under 7.0 or 7.1 and
> have it reference the trees.
>
Is there anyway to emulate this? I want to have several types of persons
which have varied and common data. How can I implement refences to a
person or a child table of person? Are there any problems with the parent
having a serial column? The index should be unique for all the children
too.

CRETE TABLE person (
    id    SERIAL,
    fname    varchar(15),
    lname    varchar(15),
    pwd    varchar(8)
);

CREATE TABLE teacher (
    uname     char(4)
) INHERITS (person);

CREATE TABLE admin (
    uname    char(8),
    type    integer
) INHERITS (person);

CREATE TABLE record (
    id    SERIAL,
    pid    integer REFERENCES person
);

- Einar Karttunen


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

Предыдущее
От: will trillich
Дата:
Сообщение: Re: explain -> how to optimize?
Следующее
От: "Eric G. Miller"
Дата:
Сообщение: Re: inheritance and primary/foreign keys