Re: Adding a Foreign Key - Mailing list pgsql-general

From Stephan Szabo
Subject Re: Adding a Foreign Key
Date
Msg-id Pine.BSF.4.21.0109031029270.76325-100000@megazone23.bigpanda.com
Whole thread Raw
In response to Adding a Foreign Key  (tankgirl@worldonline.es)
List pgsql-general
On Mon, 3 Sep 2001 tankgirl@worldonline.es wrote:

>  Hello everyone,
>
>   I know that a Primary Key can be added to a table before it has been created, doing this...
>
> CREATE UNIQUE INDEX table_pkey ON table (atribute);
>
>   Well I wonder if a Foreign Key can also be added and what syntax does it follow.

alter table <table> add <table constraint definition>

ie something like:
alter table foo add constraint foo_fk foreign key(col)
 references bar(barcol) on update cascade deferrable
 initially deferred;



pgsql-general by date:

Previous
From: Stephan Szabo
Date:
Subject: Re: query not using index
Next
From: Peter Eisentraut
Date:
Subject: Re: Adding a Foreign Key