From: | Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com> |
---|---|
To: | Scott David Walter <sdw1(at)geneseo(dot)edu> |
Cc: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: Alter Table problems |
Date: | 2001-04-27 17:44:24 |
Message-ID: | Pine.BSF.4.21.0104271041160.26669-100000@megazone23.bigpanda.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
On Fri, 27 Apr 2001, Scott David Walter wrote:
> I am attempting to add a few attributes to an existing table that already
> contains data. The problem that I am having is that the new attributes
> that I want to add need to be forgein key references to other tables. I
> can't figure out how to create the attribute with a reference to another
> table. I tried the following, but all it did was create the
> attribute... no forgein key:
>
> ALTER TABLE student ADD COLUMN major REFERENCES degree_major;
You can add the foreign key with something like:
ALTER TABLE student ADD CONSTRAINT <name> FOREIGN KEY(major)
REFERENCES degree_major;
There are lots of little issues with alter table right now that
are getting fixed as time goes on. I expect that some version
of drop column will make it into 7.2, for example.
From | Date | Subject | |
---|---|---|---|
Next Message | Steve Meynell | 2001-04-27 19:16:26 | Heres a good one... |
Previous Message | Scott David Walter | 2001-04-27 17:15:35 | Alter Table problems |