Re: can you change an FK constraint from NOT DEFERRABLE to DEFERRABLE
В списке pgsql-sql по дате отправления:
| От | 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 по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера