Subject Re: How to deactivate check constraint?
Author vincent_kwinsey
This can be necessary when someone wants to move raw data from one
gdb file (call it source) to another gdb file (source) and it can be
done much easier when check constraints (together with indexes etc.)
are deactivated on target (one can find workarounds, indeed, as
specity the sequence how data from each table are moved, but it can
be time consuming). Such data move can be necessary when source gdb
gets corrupted but data are still available from it...

--- In firebird-support@yahoogroups.com, "Adam" <s3057043@...> wrote:
>
> --- In firebird-support@yahoogroups.com, "vincent_kwinsey"
> <vincent_kwinsey@> wrote:
> >
> > 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!
> >
>
> Deactivating a system index generated to support a constraint can
> cause data errors because Firebird uses those indices to police the
> constraints.
>
> Why do you want them de-activated?
>
> Adam
>