Why can't I create two tables that are foreign keys for each other? - Mailing list pgsql-general

From Eric Du
Subject Why can't I create two tables that are foreign keys for each other?
Date
Msg-id 3951EDD6.FB29F9DE@leyou.com
Whole thread Raw
List 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 by date:

Previous
From: Tom Lane
Date:
Subject: Re: libpq error codes
Next
From: "Robert D. Nelson"
Date:
Subject: RE: Postgres with php3