Why can't I create two tables that are foreign keys for each other?

Поиск
Список
Период
Сортировка
От Eric Du
Тема Why can't I create two tables that are foreign keys for each other?
Дата
Msg-id 3951EDD6.FB29F9DE@leyou.com
обсуждение исходный текст
Список pgsql-general
Here is my sql script to create two tables that are foreign keys for
each other.

BEGIN;
CREATE TABLE t1 (
    id serial PRIMARY KEY,
    t2_id integer REFERENCES t2 INITIALLY DEFERRED
);
CREATE TABLE t2 (
    id serial PRIMARY KEY,
    t1_id integer REFERENCES t1 INITIALLY DEFERRED
);
END;

psql complains the following:
    ERROR:  Relation 't2' does not exist
    ERROR:  Relation 't1' does not exist

What's the matter?

Thanks in advance,

--
Eric Du
-----------------------------------
Tel: (86-010) 64181818-821
Fax: (86-010) 64181385
Leyou WebSite: http://www.leyou.com



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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: libpq error codes
Следующее
От: "Robert D. Nelson"
Дата:
Сообщение: RE: Postgres with php3