Subject Re: [Firebird-Architect] Re: Nulls in CHECK Constraints
Author Alex Peshkov
Ann W. Harrison wrote:
> Alex Peshkov wrote:
>
>>Should not we clarify one aspect of cross-table constraints.
>
> (Excellent example deleted. Essentially it's a cross table
> constraint for table T2 depending on values in T1. Changing
> T1 allows the constraint to be violated without error.)
>
>>Is it up to standard that enabling cross-table check constraints makes
>>it virtually impossible to strictly follow them?
>
>
> My understanding - and it's probably very flawed - is that the
> constraint applies to the table on which it is defined and is
> checked after operations on that table. Changes to other
> tables may cause problems, but that's outside the scope of the
> constraint.
>
> That makes a certain amount of sense. If I have a table T1 and
> give you read access to it, and you create a table T2 that has
> a constraint based on values in T1, you shouldn't be able to
> constraint my table, should you?
>

In that case it makes absolutely no difference, does constraint work in
system context or not. What a difference - would it be violated by
changes done, but not commited yet, or a bit later in the future.

May be we should once more think - do we really need cross-table
references in constraints? Anyway (as you've shown) it's logically
impossible to impement them correctly...