Subject Re: CHECK Constraints (was: Re: [firebird-support] Re: Checking periods don't overlap)
Author Ann W. Harrison
At 02:41 PM 6/15/2004, Ivan Prenosil wrote:

>Still nobody explained what "operate in system transaction" or
>"operate in system context" or "dirty read" or "potato" means in the context
>of this discussion, nor tried to list
>advantages/disadvantages/consequences of it.

Ah. When an entry is made into a unique index, the code that
checks to see whether there are duplicates "visible to any
active transaction" is running in "system context" or equivalently
as "in the system transaction". It's really not a "dirty read",
since it sees both committed values and uncommitted values. A
"dirty read" in my vocabulary sees only the latest version.

>If yes then here is what will happen in such case when running slightly
>changed example...

In your example, the constraint is that there be no duplicates.
An uncommitted transaction has changed a 1 to a 5. A concurrent
transaction attempts to store a 1. The system transaction would
recognize that the change is uncommitted and return an error to
the storing transaction.

Regards,


Ann