If I enable foreign key validation I cannot insert proper values, which fit with my foreign key definition. What am I missing here?
$ sqlite3 test.db
sqlite> CREATE TABLE a (id INTEGER NOT NULL, item TEXT NOT NULL);
sqlite> CREATE TABLE b (id INTEGER NOT NULL, item TEXT NOT NULL,
ref INTEGER REFERENCES a (id));
sqlite> INSERT INTO a VALUES (16, 'test');
sqlite> PRAGMA foreign_keys = 1;
sqlite> INSERT INTO b VALUES (16, 'test2', 16);
Error: foreign key mismatch - "b" referencing "a"
sqlite> SELECT * FROM a;
16|test