Search Postgresql Archives

Re: Adding Foreign Key Constraint To Existing Table

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxx> 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@xxxxxxxxxxxxxx)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux