From: | Adrian Klaver <adrian(dot)klaver(at)gmail(dot)com> |
---|---|
To: | pgsql-general(at)postgresql(dot)org, Rich Shepard <rshepard(at)appl-ecosys(dot)com> |
Subject: | Re: Adding Foreign Key Constraint To Existing Table |
Date: | 2011-07-01 21:10:04 |
Message-ID: | 201107011410.05012.adrian.klaver@gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Friday, July 01, 2011 2:00:38 pm Rich Shepard wrote:
> I've examined the 9.0 manual page on alter table without seeing how to
> add a foreign key constraint to a column.
>
> I needed to make changes on a couple of existing tables which could be
> accomplished only by dropping the foreign key constraint. That, and
> changing the table structure, column names, and column types were
> successful. But, I am not seeing the proper syntax to add a foreign key
> constraint back to the two affected tables.
>
> Pointer please.
http://www.postgresql.org/docs/9.0/interactive/sql-altertable.html
Examples at bottom of page:
"To add a foreign key constraint to a table:
ALTER TABLE distributors ADD CONSTRAINT distfk FOREIGN KEY (address) REFERENCES addresses (address) MATCH FULL;
"
>
> Rich
--
Adrian Klaver
adrian(dot)klaver(at)gmail(dot)com
From | Date | Subject | |
---|---|---|---|
Next Message | Joshua D. Drake | 2011-07-01 21:10:57 | Re: Adding Foreign Key Constraint To Existing Table |
Previous Message | Rich Shepard | 2011-07-01 21:00:38 | Adding Foreign Key Constraint To Existing Table |