Re: 7.4 - TODO : alter table drop foreign key

Поиск
Список
Период
Сортировка
От Dan Langille
Тема Re: 7.4 - TODO : alter table drop foreign key
Дата
Msg-id 3DEF6FCB.30093.74C3BAC@localhost
обсуждение исходный текст
Ответ на Re: 7.4 - TODO : alter table drop foreign key  ("Christopher Kings-Lynne" <chriskl@familyhealth.com.au>)
Список pgsql-hackers
On 5 Dec 2002 at 12:09, Christopher Kings-Lynne wrote:

> > > 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.

Regardless of what is documented, the following is valid and works:

ALTER TABLE slave  ADD FOREIGN KEY (master_id)  REFERENCES master (id) ON DELETE CASCADE;
-- 
Dan Langille : http://www.langille.org/



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: PQnotifies() in 7.3 broken?
Следующее
От: Tom Lane
Дата:
Сообщение: Re: PQnotifies() in 7.3 broken?