Re: adding on delete cascade constraint?

Поиск
Список
Период
Сортировка
От Richard Huxton
Тема Re: adding on delete cascade constraint?
Дата
Msg-id 200309191452.59650.dev@archonet.com
обсуждение исходный текст
Ответ на Re: adding on delete cascade constraint?  (Jean-Christian Imbeault <jc@mega-bucks.co.jp>)
Список pgsql-general
On Friday 19 September 2003 14:02, Jean-Christian Imbeault wrote:
> Oliver Elphick wrote:
> >>Foreign Key constraints: $1 FOREIGN KEY (pid) REFERENCES products(id) ON
> >>UPDATE NO ACTION ON DELETE NO ACTION
> >
> > Drop the constraint; then add an amended one.
>
> Ok, how do I drop the constraint, it has no name.

Its name is "$1" - use

DROP CONSTRAINT "$1" ...

> Secondly what is the correct syntax for adding a new constraint with ON
> DELETE CASCADE?

See the SQL command reference for ALTER TABLE. It's something like:

ALTER TABLE mytable ADD CONSTRAINT constraint_name FOREIGN KEY ... etc

--
  Richard Huxton
  Archonet Ltd

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

Предыдущее
От: Oliver Elphick
Дата:
Сообщение: Re: adding on delete cascade constraint?
Следующее
От: Dennis Gearon
Дата:
Сообщение: An idea for IPU ( We need another acronymn! )