Ran into this error, which surprised me since I thought SQLite's
dynamic typing allowed any value type to be stored in any column.
Either the PK or the FK seem to have some influence (with pragma
foreign_keys on or off), which I didn't expect, since the entered FK
value does match the parent row's PK.

Can anyone shed some light on this error please? --DD

C:\Users\DDevienne>sqlite3
SQLite version 3.8.3.1 2014-02-11 14:52:19
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> create table parent (sn text primary key, data text);
sqlite> create table child_int (sn integer primary key references
parent(sn), data text);
sqlite> create table child_txt (sn text    primary key references
parent(sn), data text);
sqlite> insert into parent values ('x', '1'), ('y', '2'), ('z', '3');
sqlite> insert into child_int values ('x', 'one'), ('y', 'two'), ('z', 'three');
Error: datatype mismatch
sqlite> insert into child_txt values ('x', 'one'), ('y', 'two'), ('z', 'three');
sqlite>
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to