Re: 7.4 - TODO : alter table drop foreign key

From: "Christopher Kings-Lynne" <chriskl(at)familyhealth(dot)com(dot)au>
To: "Dan Langille" <dan(at)langille(dot)org>
Cc: "PostgreSQL-development" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: 7.4 - TODO : alter table drop foreign key
Date: 2002-12-05 20:09:06
Message-ID: 01ff01c29c9a$29f7d680$6500a8c0@internal
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> > Isn't it identical? The CONSTRAINT <const> is SQL standard optional
clause
> > for all commands that add constraints.
>
> Except that one is ADD CONSTRAINT, the other is an ADD FOREIGN KEY.
> They are similar in nature but different overall.

I think you're getting a little confused here, Dan.

http://www3.us.postgresql.org/users-lounge/docs/7.3/postgres/sql-altertable.
html

There is only one command for adding constraints to a table. It has this
syntax:

ALTER TABLE [ ONLY ] table [ * ]
ADD table_constraint

The table_constraint clause is defined like this (basically):

[CONSTRAINT blah] (PRIMARY KEY or UNIQUE or FOREIGN KEY) ...

So, the CONSTRAINT blah clause allows you to specify a name for any of the 3
types of constraint: primary key, unique or foreign key. There's nothing
special about foreign keys in this case.

If you don't put in the CONSTRAINT blah clause, you get an automatically
assigned constraint name.

Chris

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Rod Taylor 2002-12-05 20:10:22 Re: 7.4 - TODO : alter table drop foreign key
Previous Message Lamar Owen 2002-12-05 20:05:22 7.3-2 RPMset released.