The check constraint is probably being evaluated (with t as a string) before any type conversion to match the column affinity is done.
On Sun, Mar 10, 2019, 2:05 PM James K. Lowden <jklow...@schemamania.org> wrote: > $ sqlite3 db "create table T (t integer not null);" > $ sqlite3 db "create table Tc (t integer not null > check(typeof(t) = 'integer'));" > $ echo 1 > dat > $ sqlite3 db ".import 'dat' T" > $ sqlite3 db ".import 'dat' Tc" > dat:1: INSERT failed: CHECK constraint failed: Tc > $ sqlite3 db "insert into Tc select * from T;" > $ sqlite3 db "select * from Tc" > 1 > $ sqlite3 db "select typeof(t) from T" > integer > $ sqlite3 db "select typeof(t) from Tc" > integer > > Why does the .import command cause the CHECK constraint to fail, when > an ordinary INSERT does not? > > --jkl > _______________________________________________ > sqlite-users mailing list > sqlite-users@mailinglists.sqlite.org > http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users > _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users