Re: BUG #1079: ALTER TABLE does not add foreign key

From: Richard Huxton <dev(at)archonet(dot)com>
To: "PostgreSQL Bugs List" <pgsql-bugs(at)postgresql(dot)org>
Cc: vova(at)densoft(dot)com(dot)ua
Subject: Re: BUG #1079: ALTER TABLE does not add foreign key
Date: 2004-02-11 18:44:56
Message-ID: 200402111844.56307.dev@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Wednesday 11 February 2004 17:29, PostgreSQL Bugs List wrote:
> The following bug has been logged online:
>
> Bug reference: 1079
> Logged by: Vladimir Sitarchuk
> Email address: vova(at)densoft(dot)com(dot)ua
>
> PostgreSQL version: 7.3
> Operating system: Red Hat 9
> Description: ALTER TABLE does not add foreign key
>
> Details:
> ALTER TABLE tablename ADD COLUMN columnname INT CONSTRAIN cntrname
> REFERENCES tablename2(col)
> adds the column But it does not add the foreign key constrain.

Perhaps the manual should be clearer on this.

You can add a foreign key with something like (example from manual):
ALTER TABLE distributors ADD CONSTRAINT distfk FOREIGN KEY (address)
REFERENCES addresses(address) MATCH FULL;
--
Richard Huxton
Archonet Ltd

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2004-02-11 19:17:44 Re: BUG #1079: ALTER TABLE does not add foreign key
Previous Message PostgreSQL Bugs List 2004-02-11 17:29:30 BUG #1079: ALTER TABLE does not add foreign key