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)
Список
Дерево обсуждения
can you change an FK constraint from NOT DEFERRABLE to DEFERRABLE frank@joerdens.de
Re: can you change an FK constraint from NOT DEFERRABLE to DEFERRABLE PFC <lists@boutiquenumerique.com>
Re: can you change an FK constraint from NOT DEFERRABLE to DEFERRABLE frank@joerdens.de
Re: can you change an FK constraint from NOT DEFERRABLE to DEFERRABLE Bruno Wolff III <bruno@wolff.to>
Re: can you change an FK constraint from NOT DEFERRABLE to DEFERRABLE Michael Fuhr <mike@fuhr.org>
Re: can you change an FK constraint from NOT DEFERRABLE to DEFERRABLE Bruno Wolff III <bruno@wolff.to>
Re: can you change an FK constraint from NOT DEFERRABLE to DEFERRABLE Greg Stark <gsstark@mit.edu>
Bruno Wolff III 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 по дате отправления