On 21 Dec 2019, at 11:12am, Thomas Kurz <sqlite.2...@t-net.ruhr> wrote:

>> Do the same thing again without the mode=ro
>> Do the files get deleted this time ?
> 
> No, this shows the same behavior, but in this case, it's actually what I'd 
> expect.

Your problem would seem to be related to all WAL operations, not just read-only 
status.

Section 4 of <https://sqlite.org/wal.html> states

" Usually, the WAL file is deleted automatically when the last connection to 
the database closes. However, if the last process to have the database open 
exits without cleanly shutting down the database connection, or if the 
SQLITE_FCNTL_PERSIST_WAL file control is used, then the WAL file might be 
retained on disk after all connections to the database have been closed. "

Section 2.3 of <https://sqlite.org/tempfiles.html> states

" The shared-memory file has the same lifetime as its associated WAL file. The 
shared-memory file is created when the WAL file is created and is deleted when 
the WAL file is deleted. "

It would seem that the sqlite command-line tool should implement this 
correctly, if anything does.  I would say that he problem is not related to 
read-only status.

I checked your problem on my own setup:

SQLite version 3.28.0 2019-04-15 14:49:49
Enter ".help" for usage hints.
Connected to a transient in-memory database.
Use ".open FILENAME" to reopen on a persistent database.
sqlite> .open test.sqlite
sqlite> PRAGMA journal_mode;
delete
sqlite> PRAGMA journal_mode=WAL;
wal
sqlite> PRAGMA journal_mode;
wal
sqlite> create table test (a integer primary key autoincrement);
sqlite> insert into test (a) values (123);
sqlite> select * from test;
123
sqlite> .quit

And got the same behaviour: the +wal and +shm files were not deleted. This 
would appear to contradict the documentation.  But I can't think of a way to 
check the state of SQLITE_FCNTL_PERSIST_WAL within the command-line tool.
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to