SQLite Forum

table locked when dropping a temp table
Login
In response to:

> > ... So, if tableA has a foreign key specification toward tableB, then tableB cannot be dropped while tableA exists (or at least its Foreign key link).

, it was asserted:

> That is untrue, at least insofar as the description of the error:

While Mr. A's statement is somewhat vague and has too many alternatives to be useful, it was at least true. Your demonstration, with its "delete from x", rid that table of all of its "Foreign Key link(s)". And Mr. A's latter alternative, (with a plausible interpretation), is consistent with the point of your demonstration rather than being falsified by it.

A more useful assertion would have been: (With foreign key enforcement enabled,) a table may not be dropped so long as it is referenced in actuality (by one or more rows) within any other table in the same database. That some other table schema(s) provide for such (potential) references is secondary, only relevant in that without such provision no actual, enforceable-by-the-DBMS references can exist.