Re: Create Foriegn Key

From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: David Busby <busby(at)pnts(dot)com>
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: Re: Create Foriegn Key
Date: 2003-06-07 03:15:02
Message-ID: 20030606201333.W45663-100000@megazone23.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


On Wed, 4 Jun 2003, David Busby wrote:

> List,
> How can I create a Foriegn Key after my table is created? I cannot find
> in docs (or google) anywhere.

See ALTER TABLE ADD CONSTRAINT, generally something of the form:

ALTER TABLE tablename ADD CONSTRAINT constraint name FOREIGN KEY(fkcol1)
REFERENCES pktable(pkcol1);

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2003-06-07 03:16:02 Re: Optimizer failure on integer column?
Previous Message Jeff Fitzmyers 2003-06-07 03:02:27 Re: Create Foriegn Key