From: | David Johnston <polobo(at)yahoo(dot)com> |
---|---|
To: | Rich Shepard <rshepard(at)appl-ecosys(dot)com> |
Cc: | "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Adding Foreign Key Constraint To Existing Table |
Date: | 2011-07-02 00:28:02 |
Message-ID: | 15D9386E-4089-4C8A-AE05-C1B973D3A6D3@yahoo.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
A foreign key is a kind of constraint. Section 5.5.3 has example syntax to add constraints, including a foreign key constraint.
In alter table the part "ADD table_constraint" is what you want to follow (it leads you to the create table page for the formal syntax to use).
David J.
On Jul 1, 2011, at 17:00, Rich Shepard <rshepard(at)appl-ecosys(dot)com> 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.
>
> Rich
>
>
> --
> Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general
From | Date | Subject | |
---|---|---|---|
Next Message | Craig Ringer | 2011-07-02 03:13:09 | Re: statically compiling postgres and problem with initdb |
Previous Message | Rich Shepard | 2011-07-01 22:04:44 | Re: Adding Foreign Key Constraint To Existing Table |