circular REFERENCES

From: Gregory Seidman <gss+pg(at)cs(dot)brown(dot)edu>
To: postgres list <pgsql-general(at)postgresql(dot)org>
Subject: circular REFERENCES
Date: 2002-06-18 20:44:47
Message-ID: 20020618204446.GA21142@cs.brown.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I would like to define two tables:

CREATE TABLE Person (
id SERIAL not null,
-- ...
team_membership integer default null REFERENCES Team(id),
primary key (id)
);
CREATE TABLE Person (
id SERIAL not null,
-- ...
captain integer not null REFERENCES Person(id),
primary key (uid)
);

Of course, I can't define them that way. Is there any better way to take
care of this than to leave out the REFERENCES in the first table and add it
with ALTER TABLE ADD CONTRAINT after the second table has been defined?

--Greg

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Varun Kacholia 2002-06-18 21:01:09 Highly obscure and erratic
Previous Message Darren Ferguson 2002-06-18 20:20:13 Re: jobs.postgresql.org - Who's interested?