Re: Tables referencing each other

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Tables referencing each other
Дата
Msg-id 11698.1071866538@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Tables referencing each other  (Felix Finch <felix@crowfix.com>)
Список pgsql-general
Felix Finch <felix@crowfix.com> writes:
> CREATE TABLE xyzzy (a INT PRIMARY KEY, b INT REFERENCES plugh);
> CREATE TABLE plugh (c INT PRIMARY KEY, d INT REFERENCES xyzzy);

> I can't actually do this in 7.4, so I had to create the first table
> without the reference.

> Is it possible to pre-declare the second table, similar to a C
> prototype, so the first definition would not complain about the second
> table being unknown?

No.  What you do is create the tables, then ALTER TABLE ADD FOREIGN KEY.

            regards, tom lane

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: DB & Log Files removed...
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Salvage older PostgreSQL data disk - help?