Re: How to add "on delete cascade" constraints

Поиск
Список
Период
Сортировка
От Raymond O'Donnell
Тема Re: How to add "on delete cascade" constraints
Дата
Msg-id 4F9AF948.9030102@iol.ie
обсуждение исходный текст
Ответ на Re: How to add "on delete cascade" constraints  (Alexander Farber <alexander.farber@gmail.com>)
Список pgsql-general
On 27/04/2012 20:40, Alexander Farber wrote:
> So it's not a problem to drop and recreate the FOREIGN KEYs?

No, unless you're doing it on a production system, and someone inserts a
value that'll doesn't agree with the foreign key while it's gone.

Adding the constraint back in may take a while (depending on how big
your table is) as contents of the columns involved need to be checked to
ensure they contain valid values.

Also, I think maybe an exclusive lock is required, which will block out
other users - not sure about this - others on this list will know.

> And can I use START TRANSACTION while doing it?

Yes, absolutely - transactional DDL is one of PG's great strengths.

Ray.


--
Raymond O'Donnell :: Galway :: Ireland
rod@iol.ie

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

Предыдущее
От: Merlin Moncure
Дата:
Сообщение: Re: how to execute a stored function that returns a boolean?
Следующее
От: Richard Broersma
Дата:
Сообщение: Re: How to add "on delete cascade" constraints