Hi,
I stumbled upon a bug in my code which looked like a wrong sqlite behavior.
When simply using the "begin - pragma journal_mode=wal - commit" query 
sequence, sqlite return a proper error saying this is not allowed.
However if I execute a command affecting the database structure (such as create 
table) before setting the journal mode,
sqlite silently fails and the journal_mode stays the same.

I'm on sqlite 3.8.0.2 and can easily reproduce this using the sqlite cli binary 
:
→ sqlite3 foo.db
sqlite> begin;

sqlite> pragma journal_mode=wal;
Error: cannot change into wal mode from within a transaction

sqlite> create table foo(bar varchar);
sqlite> pragma journal_mode=wal;
journal_mode
------------
delete

sqlite> commit;
sqlite> pragma journal_mode;
journal_mode
------------
delete

I know it's not a good behavior to have structure queries inside a transaction 
(and that's how I fixed it),
still is it expected for sqlite not to fail in this case ?

thanks,
Jean.
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to