SQLite Forum

Renaming a database
Login
The situation is more complicated.

The behaviour depends on both the operating system and the file system.  Various combinations of these

Block attempts to rename a file which is open.

Allow renaming an open file but do not notify the applications which have it open.  This means that the application may temporarily close the file (e.g. because it ran out of file handles) then crash when it tries to reopen the file.

Allow renaming, after closing all file handles for the file, meaning that the application which had the file open will crash the next time it tries to use it.

All of these present problems for anything that relies on you renaming files.  And they're further complicated because SQLite automatically makes and deletes files with similar names to the database as it works and does not get notified if a filename is changed while its in use.

Once again: anything that has meaning is data.  A file's name is not data, it's an obscure detail of how computers maintain some kinds of storage.  If you have data it should be *in a database*, not the name of a file on a storage device.