SQLite Forum

table locked when dropping a temp table
Login
If the error message is "Table is locked" then the issue is *NOT* a foreign key constraint.  Violation of a foreign key constraint will raise the error "foreign key constraint failed".

The error "Table is locked" would not be caused by a foreign key constraint.  It is caused by an attempt (in this case) to drop a table while it is in use. 

Clearly, you cannot drop a table in the midst of it being used.