Re: Adding Foreign Key Constraint To Existing Table - Mailing list pgsql-general

From David Johnston
Subject Re: Adding Foreign Key Constraint To Existing Table
Date
Msg-id 15D9386E-4089-4C8A-AE05-C1B973D3A6D3@yahoo.com
Whole thread Raw
In response to Adding Foreign Key Constraint To Existing Table  (Rich Shepard <rshepard@appl-ecosys.com>)
List 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
theformal syntax to use). 

David J.

On Jul 1, 2011, at 17:00, Rich Shepard <rshepard@appl-ecosys.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@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general

pgsql-general by date:

Previous
From: Rich Shepard
Date:
Subject: Re: Adding Foreign Key Constraint To Existing Table
Next
From: Craig Ringer
Date:
Subject: Re: statically compiling postgres and problem with initdb