Subject Re: [ib-support] check constraint stops working after backup and restore
Author Martijn Tonies
Helen,

> >my problem is:
> >I create a domain with check constraint.
> >
> >e.g.
> >ALTER DOMAIN D_TRANSPORT_TYPE_ID
> >ADD CHECK (exists
> > (
> > select *
> > from transport_types
> > where tt_id = value
> > ))
> >
> >This constraint works OK. After backup and restore it stops working. It
> >objects even if the data is OK. Problem goes away after recompilation of
> >the constraint.
>
> Not a bug, exactly...my guess is that, at the time the CHECK constraint is
> being added, the table transport_types doesn't exist. It's a cert that
> gbak rebuilds domains before it begins on tables. I'd recommend doing
this
> with insert and update triggers rather than a CHECK constraint. Stick
with
> constants in CHECK expressions.

Check constraints on Tables are alright. But with a domain, you should use
a value-check constraint, no constraint related to tables/views etc...

My 0.02...

With regards,

Martijn Tonies
InterBase Workbench - the developer tool for InterBase
http://www.upscene.com

Firebird Workbench - the developer tool for Firebird
http://www.upscene.com

Upscene Productions
http://www.upscene.com

"This is an object-oriented system.
If we change anything, the users object."