Subject Re: [firebird-support] can i use UDFs with CHECK constraint (trigger) ?
Author Helen Borrie
At 12:28 AM 18/03/2004 +0530, you wrote:
>dear friends
>i m having many fields in many tables which are required to have some
>minimum length strings
>so i thought to define DOMAIN for such kind of field, like following
>CREATE DOMAIN CODENAME VARCHAR(50) CHECK ( strlen( Value ) > 5 ) );
>but it generates error,
>is there any way to use UDFs in CHECK constraints , so that i dont have to
>write same code in all triggers

This would NOT be a good idea, even if were possible. Nor is it necessary
or desirable to add extra cycles for tests that are completely
redundant. The engine size-checks data and throws an exception if you try
to overflow it.

It *does* make sense to define a domain for specific size restriction but
it doesn't make sense to apply that domain to a column that has a smaller
limit than the domain permits.