Subject How to deactivate check constraint?
Author vincent_kwinsey
Hi,

there can be defined check constraints on table (for fields) and
they can be listed by (it is a bit sad that no spearate table exists
for them...):

select rdb$trigger_name from rdb$check_constraints
where not rdb$constraint_name starting 'INTEG' and
rdb$constraint_name not in (select jj.rdb$constraint_name
from rdb$ref_constraints jj)

So - the problem is - hoe deactivate them? They are not indices - so
alter index.. inactive cann;t work.

One can try to inactivate the system trigget automatically created
and associated with each of check constraint, e.g.:
alter trigger CHECK_87 inactive

But then the following error message is issued:
This operation is not defined for system tables.
unsuccessful metadata update.
MODIFY TRIGGER failed.
action cancelled by trigger (1) to preserve data integrity.
Cannot update trigger used by a CHECK Constraint.

From my experience - even the restore with referenetial constraints
does'nt make check constraints inactive (although - user defined
triggers are deactivated due to this).

So - from my point of view - one should drop and recreate check
constraints - this is the only way how to deactivate/active them!!
Or there is more direct and less painful way available?

Thanks for any hint in advance!