In the footer of <https://www.sqlite.org/lang_altertable.html> it is said:

It is important that both of the above procedures be run from within a 
transaction to prevent other processes from accessing the database file while 
the schema change is only partially complete. 


But this statement is not true for the first procedure, where it is
suggested to disable and later re-enable foreign keys.

It is not possible to change foreign_keys once within a transaction.
So the suggestion in the footer is, at very least, misleading and can
potantially cause some very serious troubles. For example, if user
is not aware of the fact that 'PRAGMA foreign_keys = 0;' inside
transaction is a no-op.

Reply via email to