Re: can you change an FK constraint from NOT DEFERRABLE to DEFERRABLE

Поиск
Список
Период
Сортировка
От Greg Stark
Тема Re: can you change an FK constraint from NOT DEFERRABLE to DEFERRABLE
Дата
Msg-id 87sm2cwxwb.fsf@stark.xeocode.com
обсуждение исходный текст
Ответ на Re: can you change an FK constraint from NOT DEFERRABLE to DEFERRABLE  (Bruno Wolff III <bruno@wolff.to>)
Список pgsql-sql
Bruno Wolff III <bruno@wolff.to> writes:

> It does look like you can only ADD and DROP constraints, not directly
> alter or replace them. So making a reference deferable is go to require
> a DROP and ADD which will need to recheck the constraint.

I asked the same question a few days ago on pgsql-general.

In short, if you want to skip the rechecking you have to update system tables
directly and you have to do two of them. 

The updates you want would look something like these. But these would do *all*
your constraints, make sure to get only the ones you really want to change:

update pg_constraint set condeferrable = 't' where contype = 'f'
update pg_trigger set tgdeferrable=true where tgisconstraint = true


I think an ALTER CONSTRAINT to change these settings as well as the 
ON {UPDATE,DELETE} behaviour would be neat.

-- 
greg



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

Предыдущее
От: "Joel Fradkin"
Дата:
Сообщение: Re: delphi access question?
Следующее
От: Chris Browne
Дата:
Сообщение: Re: New record position