CREATE TABLE with REFERENCE

Поиск
Список
Период
Сортировка
От kay-uwe.genz
Тема CREATE TABLE with REFERENCE
Дата
Msg-id DE982951-C117-11D7-905D-000A27B51AF2@web.de
обсуждение исходный текст
Ответы Re: CREATE TABLE with REFERENCE  (Dmitry Tkach <dmitry@openratings.com>)
Re: CREATE TABLE with REFERENCE  (Rajesh Kumar Mallah <mallah@trade-india.com>)
Re: CREATE TABLE with REFERENCE  (Stephan Szabo <sszabo@megazone.bigpanda.com>)
Список pgsql-general
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?

Second question. Is there a method of INSERT INTO both tables VALUES
without group them in the same Transaction?

regards

Kay-Uwe

Вложения

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

Предыдущее
От: Alvaro Herrera
Дата:
Сообщение: Re: Monitoring DB activity PosgreSQL 7.3.2
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Using YY-MM-DD date input