Weissmann Markus <[EMAIL PROTECTED]> wrote:
could someone please elaborate on this one?
sqlite> create table t (a int primary key, b int, check(0<b<1000));
sqlite> insert into t(b) values(100000000);
does not complain, so what checks exactly can we do now?
check(0<b<1000) does not do what you think it does. An expression
0<b<1000 is evaluated as (0<b)<1000. That is, first (0 < b) is evaluated
and returns 0 or 1 depending on whether the condition is false or true.
Next, (x < 1000) is evaluated where x is 0 or 1 (the result of the first
subexpression). Obviously, this latter condition is always true.
You want check(0<b and b<1000)
Igor Tandetnik