Why aren't my sqlite3 foreign keys working?
问题 I run the following code from a python interpreter, and expect the insert statement to fail and throw some kind of exception. But it's not happening: Python 2.6.5 (r265:79096, Mar 19 2010, 21:48:26) [MSC v.1500 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import sqlite3 >>> conn = sqlite3.connect("test.db") >>> conn.executescript(""" ... pragma foreign_keys=on; ... begin transaction; ... create table t1 (i integer primary key, a); ...