Subject Re: [ib-support] check constraint stops working after backup and restore
Author Nando Dessena

> > Not an answer to your question, but I'd use a foreign key constraint instead of a domain.
> But then you have to create many foreign keys (we use this domain on
> many places). Defining this constraint on a domain saves (actually would
> save :-| ) work. And then there is still the problem with necessity of
> creating indexes for foreign keys ...

your reasoning would be corrct if we were comparing equivalent
functionality, but a check constraint (be it a domain, column or table
constraint) won't give you the same functionality as a foreign key.

Try to do

delete from transport_types

and see for yourself what I mean.

You simply can't enforce referential integrity with domains, they are
not here for that purpose.

Having said this, I can see something wrong in the way Firebird behaves;
perhaps the restore should abort, or perhaps it should apply the
cconstraint only after restoring the tables, as you have pointed out.
Silently ignoring the cconstraints doesn't seem right to me. You may
want to discuss this one in Firebird-devel.