> On Apr 10, 2017, at 2:21 PM, J. King <jk...@jkingweb.ca> wrote:
> 
> It is not possible to open read-only WAL databases. The opening process must 
> have write privileges for "-shm" wal-index shared memory file associated with 
> the database, if that file exists, or else write access on the directory 
> containing the database file if the "-shm" file does not exist. 

Yes, that's the documentation I was referring to. It only states that the 
process must be able to create/write the -shm file. It doesn't say anything 
about opening the database with SQLITE_OPEN_READONLY.

IMHO, since the -shm file is only a cross-process temporary index of the WAL 
file, SQLite should be allowed to create this file even if the database itself 
is read-only. Otherwise opening a database read-only will sometimes succeed and 
sometimes fail on a writeable filesystem, depending on whether or not the -shm 
file already exists. This caused me some confusion this morning — I was running 
new test code that reads a number of existing sample databases, and some of 
them would mysteriously fail to open. Even weirder, after I inspected a problem 
database using the `sqlite3` tool, the problem with it went away! (Of course, 
the tool was creating the missing -shm and -wal files when it opened the file…)

—Jens
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to