Re: CREATE TABLE with REFERENCE

Поиск
Список
Период
Сортировка
От Dmitry Tkach
Тема Re: CREATE TABLE with REFERENCE
Дата
Msg-id 3F256A54.4000402@openratings.com
обсуждение исходный текст
Ответ на CREATE TABLE with REFERENCE  (kay-uwe.genz <kug1977@web.de>)
Ответы Re: CREATE TABLE with REFERENCE  (Jonathan Bartlett <johnnyb@eskimo.com>)
Список pgsql-general
kay-uwe.genz wrote:

>Hi @ all,
>
>i've a little problem with two tables and FOREIGN KEYs. I've read about
>this long time ago, but didn't remember me where. Well, I hope you can
>help me.
>
>I've create two TABLEs "counties" and "cities". "Countries" have a row
>"capital" is REFERENCEd "cities". "cities"  have a row country
>REFERENCEd "countries", where a save the country the city is placed.
>
>And now PG couldn't create the TABLEs, because the referenced table
>doesn't exists in time of creation. Is there another method of creating
>than the ALTER TABLE the first table after the second is living?
>
No. But what's wrong with ALTER TABLE?

>
>Second question. Is there a method of INSERT INTO both tables VALUES
>without group them in the same Transaction?
>
>
No (assuming, that you are talking about inserting a new country and a
capital at the same time, and that the country's capital column cannot
be null).
But what's wrong with transactions?

Dima



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

Предыдущее
От: Thien-Thi Nguyen
Дата:
Сообщение: Re: 7.3.3 array_out tweak
Следующее
От: Rajesh Kumar Mallah
Дата:
Сообщение: Re: CREATE TABLE with REFERENCE