On Wed, Mar 6, 2013 at 9:30 AM, Dominique Devienne <ddevie...@gmail.com> wrote: > You don't have to use triggers, you can use a check constraint instead > (simpler, but also perhaps faster as well?). > > If you do, you loose some of the implicit type conversions SQLite does, > based on type affinity, so the "1" no longer gets converted to 1.
Nah, use this sort of CHECK constraint: CREATE TABLE toy(a INTEGER CHECK(a = CAST(a AS INTEGER))); sqlite> insert into toy values (1); sqlite> insert into toy values ('1'); sqlite> select quote(a) from toy; 1 1 sqlite> Cool, no? > I also would prefer a strong-typing mode though (as an opt-in pragma for > example), rather than adding a bunch of check constraints, and built-in > strong-typing would likely be faster. But Dr. Hipp prefers dynamic typing, > so dynamic typing it is :). I too would like an option for stronger typing, but CHECK constraints will do for now. Nico -- _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users