-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: sqlite pragma order for auto_vacuum #3230
fix: sqlite pragma order for auto_vacuum #3230
Conversation
The SQLite docs don't say anything about the relative ordering with
|
Yeah, I went looking for the docs on this but it's not mentioned. But this issue is visible with the SQLite command line tool as well. For example:
Now enable wal mode first:
So by choosing the ordering that SQLx is choosing, |
I can reproduce that, but going back to what the SQLite docs say, if I then run a
I think this is SQLite behaving as documented: changing the journal mode marks the database as "dirty" and so it needs an explicit vacuum for the change to the |
The exact same behavior occurs when doing anything else in the database that marks it as dirty (using a fresh database file here):
|
I think there is an expecation that if I'm only setting options, and creating a new database, then I don't need to follow the note about existing databases. I'd expect to if I had created tables. Perhaps a documentation update on
|
Yeah, I suppose there's no reason not to send the |
Setting the auto_vacuum pragma must come before setting the journal mode otherwise it won't apply.
Co-authored-by: Austin Bonander <austin.bonander@gmail.com>
1c200bc
to
fbc253d
Compare
* fix: sqlite pragma order for auto_vacuum Setting the auto_vacuum pragma must come before setting the journal mode otherwise it won't apply. * fix: better documentation for auto_vacuum Co-authored-by: Austin Bonander <austin.bonander@gmail.com> --------- Co-authored-by: Austin Bonander <austin.bonander@gmail.com>
* fix: sqlite pragma order for auto_vacuum Setting the auto_vacuum pragma must come before setting the journal mode otherwise it won't apply. * fix: better documentation for auto_vacuum Co-authored-by: Austin Bonander <austin.bonander@gmail.com> --------- Co-authored-by: Austin Bonander <austin.bonander@gmail.com>
* fix: sqlite pragma order for auto_vacuum Setting the auto_vacuum pragma must come before setting the journal mode otherwise it won't apply. * fix: better documentation for auto_vacuum Co-authored-by: Austin Bonander <austin.bonander@gmail.com> --------- Co-authored-by: Austin Bonander <austin.bonander@gmail.com>
Setting the auto_vacuum pragma must come before setting the journal mode otherwise it won't apply.
Simple test app:
In current git main, if
journal_mode
option is set,auto_vacuum
will not take affect. Work-around is to execute aPRAGMA auto_vacuum = 1; VACUUM
on the connection, but that shouldn't be needed for a newly created database.