Closed simonw closed 2 weeks ago
The key problem here is that opcodes are not a stable feature of SQLite, so it was always risk to attempt to use them in this way.
We need to ensure SQLite 3.46.0 is covered in the new tests here:
Posted about this on the SQLite forum - https://sqlite.org/forum/forumpost/0adbc56447 - but since opcodes are an undocumented and unsupported interface I don't expect them to fix it.
This mechanism here was already supposed to catch things if SQLite broke the mechanism I was using:
But it didn't think to catch AttributeError
.
Here's the macOS SQLite 3.46.0 libsqlite3.0.dylib
I was using: https://static.simonwillison.net/static/2024/libsqlite3.0.dylib
Here's the commit that removed this feature: https://sqlite.org/src/info/dd5977c9a8a418be
I manually tested the patch to 0.64.x like this:
DYLD_LIBRARY_PATH=sqlite-3.46.0 datasette fixtures.db -m issue-2353.yaml -p 8034
Then visited http://127.0.0.1:8034/fixtures/demo?table=facetable and it worked.
I confirmed that the page had an error before applying that cherry-pick.
Here's the full set of changes going out in 0.64.7: https://github.com/simonw/datasette/compare/0.64.6...0.64.7
Blogged about the release here: https://simonwillison.net/2024/Jun/12/datasette-0647/
Reported on Discord: https://discord.com/channels/823971286308356157/823971286941302908/1248924498128932914
I managed to replicate it locally using this trick https://til.simonwillison.net/sqlite/sqlite-version-macos-python
Where
datasette.yml
has this:Then navigate to http://127.0.0.1:8001/fixtures/demo
Within the
--pdb
debugger I could see this:Note that the
Variable
opcode now hasp4
asNone
- and the name of the variable no longer appears in any of the opcodes!