On Wednesday, 2 March, 2016 19:54, Ward WIllats <sqlite-users at wardco.com> 
wrote:

> We have multiple processes trying to access an sqlite DB while one of them
> is inside a transaction trying to migrate the schema. Before the migrate
> transaction is started, pragma foreign_keys=0 is executed. Yet, in the
> middle of the migration, we get a constraint violation as though another
> process did pragma foreign_keys=1 and turned them back on.

> Now, this diagnosis may or may not be correct, we are running more tests,
> but I thought I'd just ask here if foreign key enforcement is an attribute
> of the connection, or if it an aspect of the database file itself?

Foreign key constraint enforcement is an attribute of the connection.  
Enforcement of other constraints (index/unique/check) are an attribute of the 
database.

The former can be turned off or deferred until commit time with pragma 
statements, the latter cannot.




Reply via email to