On Thu, Apr 07, 2011 at 02:44:49PM -0700, Duquette, William H (318K) scratched on the wall: > Howdy! > > I have a database with tables defined like this: > > CREATE TABLE table1 ( > id INTEGER PRIMARY KEY, > value REAL DEFAULT 1.0 CHECK (0.0 <= value) > ); > > CREATE TABLE table2 ( > id INTEGER PRIMARY KEY, > value REAL DEFAULT 1.0 CHECK (0.0 <= value AND value <= 1.0) > ); > > The following statements should each fail with a constraint error: > > UPDATE table1 SET value='NONESUCH' WHERE id=1; > UPDATE table2 SET value='NONESUCH' WHERE id=1; > > > For some reason, setting the value in table2 fails, as it should, but > setting the value in table1 succeeds when it shouldn't.
Text values are greater than numeric values. Hence the check is valid: http://sqlite.org/datatype3.html#comparisons You might want to add CHECK ( typeof( value ) == 'real' ) -j -- Jay A. Kreibich < J A Y @ K R E I B I.C H > "Intelligence is like underwear: it is important that you have it, but showing it to the wrong people has the tendency to make them feel uncomfortable." -- Angela Johnson _______________________________________________ sqlite-users mailing list [email protected] http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

