Re: inheritance and primary/foreign keys

Поиск
Список
Период
Сортировка
От Stephan Szabo
Тема Re: inheritance and primary/foreign keys
Дата
Msg-id Pine.BSF.4.21.0103071550120.75092-100000@megazone23.bigpanda.com
обсуждение исходный текст
Ответ на inheritance and primary/foreign keys  ("Daniel J. Kressin" <dkressin@globalcrossing.com>)
Ответы Re: inheritance and primary/foreign keys
Re: inheritance and primary/foreign keys
Re: inheritance and primary/foreign keys
Список pgsql-general
On Wed, 7 Mar 2001, Daniel J. Kressin wrote:

> Question 1: If table A has as its primary key "a_pk" and table B
> inherits table A, then table B also has as its primary key a_pk.  Is
> that correct?

I don't believe so currently.

> Question 2: If I want table C to have a foreign key on both A and B, is
> the following syntax correct? (I'm using 7.0.3)
>     CREATE TABLE c (
>         c_fk    correct_type    REFERENCES a*(a_pk)
>     );
> (The question is, Do I need the *?)
>
> Question 3: I understand that the default action on this will reverse in
> 7.1 (i.e. the default will then be to reference all tables unless ONLY
> is specified).  Am I correct in assuming that the dump/restore (required
> for upgrading) will take care of this, or will I need to recreate table
> C manually removing the *?

You cannot safely reference tops of inheritance trees under 7.0 or 7.1 and
have it reference the trees.

Which reminds me, the fk constraint triggers should probably specify ONLY
on their queries or they'll fail strangely under 7.1.



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

Предыдущее
От: "Daniel J. Kressin"
Дата:
Сообщение: inheritance and primary/foreign keys
Следующее
От: Christopher Sawtell
Дата:
Сообщение: Re: Data types?