Subject | Re: [firebird-support] Re: Possible bug with CHECK constraint |
---|---|
Author | Ann W. Harrison |
Post date | 2004-10-04T15:03:16Z |
>I wrote:At 01:38 PM 10/3/2004, Roman Rokytskyy wrote:
>
> > Firebird evaluates constraints before the action, not after.
>Again, please. Do you say that Firebird checks the constraint beforeYes. Typically, a Firebird constraint checks the new value using
>the INSERT
the new context variable against some condition. If the new value
fails the test, then it is not stored. The "Firebird" way to state
your constraint is "new.value < 20".
Check constraints are implemented as special triggers (not necessarily
the best idea, but hey, it's an idea), and executed immediately before
the operation.
>when the table is perfectly consistent, then it allowsFirebird constraints are designed to validate the current update,
>INSERT without checking the values, etc. making the database
>inconsistent (e.g. any update or insert that does not fix the problem
>will fail even when data are perfectly correct)?
not to describe the whole state of the database. That's non-standard
and something we will have to address when we begin supporting
deferred constraints. However, any change will (I suspect) affect
currently working applications, so care is required.
Regards,
Ann