Modifying a foreign key constraint?

Поиск
Список
Период
Сортировка
От Marc Branchaud
Тема Modifying a foreign key constraint?
Дата
Msg-id 45CC99F1.2070909@x2omedia.com
обсуждение исходный текст
Ответы Re: Modifying a foreign key constraint?  (Richard Broersma Jr <rabroersma@yahoo.com>)
Список pgsql-general
What's the best way to modify a foreign key constraint?

I need to change a foreign key from ON DELETE NO ACTION to ON DELETE
CASCADE.  Should I just drop the constraint and re-add it?  For example:

ALTER TABLE foo DROP CONSTRAINT foo_bar_id_fkey;

ALTER TABLE foo ADD FOREIGN KEY (foo_bar_id_fkey) REFERENCES bar(id) ON
DELETE CASCADE;

Is there a more compact way to do this, perhaps with a single ALTER
TABLE command?

Thanks!

        Marc

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

Предыдущее
От: Marc Branchaud
Дата:
Сообщение: Re: Modifying a foreign key constraint?
Следующее
От: "Merlin Moncure"
Дата:
Сообщение: Re: Adding TEXT columns tanks performance?