Skip to content

Update SQLite to 3.51.3#2236

Draft
azizcodesthings wants to merge 3003 commits into
tursodatabase:mainfrom
azizcodesthings:codex/update-sqlite-3.51.3
Draft

Update SQLite to 3.51.3#2236
azizcodesthings wants to merge 3003 commits into
tursodatabase:mainfrom
azizcodesthings:codex/update-sqlite-3.51.3

Conversation

@azizcodesthings
Copy link
Copy Markdown

@azizcodesthings azizcodesthings commented May 18, 2026

Summary

  • Update vendored SQLite to 3.51.3 and regenerate the bundled libsql-ffi SQLite artifacts.
  • Restore libSQL compatibility targets on top of SQLite autosetup (libsql, liblibsql_install, rusttest, and rusttestwasm).
  • Reintroduce libSQL legacy wasm configure flags (--enable-wasm-runtime, --enable-wasm-runtime-dynamic, and --enable-wasm-runtime-wasmedge) for existing workflows.
  • Preserve libSQL reserved-byte behavior used by WAL/encryption paths: reserve-byte reads now use SQLite's negative query sentinel, the requested reserve setting follows SQLite 3.51 again, the effective reserve passed to the pager remains clamped to the active page reserve, and tests set reserve bytes before entering WAL mode because SQLite 3.51 does not rewrite the database header reserve during VACUUM while in WAL mode.
  • Carry forward libSQL's vector-aware VACUUM table-copy behavior while honoring SQLite 3.51's randomized temporary vacuum schema name; the old hard-coded vacuum_db name made upstream Tcl vacuum/autovacuum tests fail under the new SQLite flow.
  • Canonicalize FLOAT8 vector padding by zeroing alignment bytes during conversion and serialization, avoiding allocator-dependent blob bytes in serialized vectors and generated bundled artifacts.
  • Skip libSQL vector indexes in SQLite 3.51's new integrity-check row-count comparison, matching the existing per-row integrity-check skip for vector indexes and keeping PRAGMA integrity_check from reporting valid vector indexes as corrupt.
  • Update SQLite Tcl corruption-test expectations for the duplicate wrong # of entries in index ... diagnostics now emitted by the SQLite 3.51 integrity-check flow.
  • Update the prebuilt v2 vector-index compatibility test for the tied cosine-distance result now returned in rowid order (b before c) for the [-1,1,1,1] query.
  • Unregister SQLite's WAL restart faultsim callback at the end of walrestart.test; otherwise the callback can outlive its slave Tcl interpreter and make the next test fail while opening test.db.
  • Preserve encrypted embedded-replica reopen behavior: when SQLite 3.51 rejects connection-local cipher config lookup before keying an existing encrypted database, libSQL now accepts the bundled AES-256-CBC default as a successful cipher selection and covers this with an injector regression test.
  • Carry forward the CRR tableinfo reset ordering used by the prior SQLite update so the test avoids resetting with a second connection already open.
  • Check in test/rust_suite/Cargo.lock so extension CI resolves Rust-compatible dependencies consistently.
  • Route the SQLite btree Tcl test harness through tclsqlite.h so Tcl 8.6 CI runners still get the Tcl_Size compatibility definition.

Test plan

  • CI

stephan and others added 30 commits September 25, 2025 14:44
… just its prologue.

FossilOrigin-Name: 75079401753778e3bc2f7fa307de9217e8d1ec395079fc1009060f707be32943
[forum:/forumpost/28e21085f9c6a4e7|Forum post 28e21085f9].

FossilOrigin-Name: 2914e8fc7b10e8b42c9a0fbd0e71f495714cee3cae67b8c238d37b1e7ec22359
… 32/64-bit of both vanilla and esm, and (B) build each variant to its own subdir so that they can build in parallel. It can, with make -j4, now build all new variants in half the time it previously took for just the 32-bit builds. The new build logging output, though unconventional, serves two purposes: (A) improve my build-time situational awareness and (B) it help demystify some of the build steps and output files.

FossilOrigin-Name: 2f4be98614b49def2c2951887796c736269ef3bb7ba5b045cae5f748ae165a83
…he new build. Fix the preprocessing flags for tester1-esm.html.

FossilOrigin-Name: ab6eb4d3b723107da488770b1849b9f1d1c491348f1eaa544e0e07356b8fac7d
…, and add module-symbols.html to the dist.

FossilOrigin-Name: e9a6391b377b6964620285192262a4dc9fe1712799f7aa8a8b37c5f718544ed2
…S_SPILL values.

FossilOrigin-Name: 4c1118ba40172af61d9304dec7a9c7344566e6a5963a317880ad232bebb40176
FossilOrigin-Name: 2f8b461c636ce2c0e7970c00d1e6ea62cdef72273150fea6aabe4e9292724977
FossilOrigin-Name: b516109e5accc885b71900402c800ae855407552648861334c895f0e5dea4ee5
… to any test apps yet. Improve invalid-arg detection in c-pp.

FossilOrigin-Name: 69086be8a155d70d9dd7b655b66809250b24fe6d5bcdc6cb5e0275446a43f51d
FossilOrigin-Name: 118f97ddcd8f888715825a623c02d42b92a82737a316f7bee4cd66f570945346
…uments.

FossilOrigin-Name: df9ab8a35517e3a2baf4b19d07d46ce3f8b48043ccdeadef22bffc12e80461c3
FossilOrigin-Name: c50a3c45a20e5b9d48e749818bea06dfa99b729535e0617347c6ece1d277a447
…k just

like json_each() and json_tree() except that the "value" column is JSONB
instead of JSON text when the "type" is 'object' or 'array'.

FossilOrigin-Name: dfc41cb3aad7fedd834baaaba0d8e3aeb55a249af4f0934397652ea9c59dc9fc
…in the shell tool. [forum:/forumpost/82b513b116 | Forum post 82b513b116].

FossilOrigin-Name: 730323f95d126162fd2867dbee1e1f1fc1d6e05b8a905a6767c4ab1cb43dacff
FossilOrigin-Name: d022ee167b90a7c32049a93d476e869270018017f60551185024409730d77640
the "{m,n}" syntax of the regexp extension.

FossilOrigin-Name: 8f17e1d869685b51f3368feed03dc06543ec16bc8fd81b8daad2ac2dbf99c5d6
…ader because its generated makefile code is currently broken.

FossilOrigin-Name: 36bc2514f70af5608aa20903d9c38b316603e2f78f2cbf4a20c7c79b60c5b8d5
"{p,q}" syntax, as performance of the NFA used to do pattern matching
is linear in the maximum such integer.  The limit is SQLITE_MAX_REGEXP_REPEAT
which defaults to 999.  This helps to prevent DoS attacks in systems that
make use of the regexp extension.

FossilOrigin-Name: 911c745f88c0ee8569e67bbcbbab034264f8c981b505aadac3ce7289486a1a68
…ERN_LENGTH

FossilOrigin-Name: 869c968569b09d05a5b7d587d8fddb3b4611daf7467dc157701e5dc6c9608606
…wasm filename gets injected into the JS files.

FossilOrigin-Name: e878ffd2eaa87e2978c44fcd03a1eb6114a9ae31e31101898d682f43cf81000f
…re 32-/64-bit performance (spoiler alert: the latter is consistently roughly 10% slower). Add WASM heap usage info to speedtest1.

FossilOrigin-Name: 70b944cc0189309c2265b184381f2f050bced7b83f204d57b912def6e203982a
…e log output very slightly less verbose.

FossilOrigin-Name: 64715e92708e4f8c5b82c1f4ed71b75f418bf741f7f05516eab309582fbfad2b
FossilOrigin-Name: 1078aa4f1e5685d45e31eea622865ddd077f367f1cec90fc267e8ba50cbe2ee9
…target b-all to run all known wasm builds.

FossilOrigin-Name: a4edaecc9b0b649df53a99e05d9abfbc5bdb40d45c7c6940a50b24fa30dca158
… outputs in a single invocation.

FossilOrigin-Name: c7633373046ceb94f293b8fbd4f436a1eb281c2744d97334c6e7e3a803d8eac2
FossilOrigin-Name: dced5a7c434b83553ede533f71e3133450795c12fc67acd1a55fdedfa8fed76c
FossilOrigin-Name: 1fa7e32d264f8329a8c9b0b5b469f1fc7ccadee86696d65e05df7fa3868af158
… much simpler way to get the proper WASM file name injected into each JS build.

FossilOrigin-Name: ffd5c8eaa89250a043b573c3eb66693dfec087a5b5eef184ae6d7bfbcf61235a
FossilOrigin-Name: 2b34b750b5528b6dda195bc1a3895dc3fe46e70cbf992a78111316e2726c1ade
".import --csv" command in the CLI.

FossilOrigin-Name: a8093d45e0f59fd55ea4cba515e9e2eb3683bb0a4f4c062747cfb4074ae3db73
drh and others added 16 commits December 31, 2025 18:46
…sion.

FossilOrigin-Name: 54398a2504a8a2ac47a461518df51406b29e63f1688f6ec108a41ac7b4b346f9
…ue cursor numbers, even if the EXISTS expression in the WHERE clause is a copy of an expression from the result-set of the SELECT.

FossilOrigin-Name: d485e8fccc7cae338bd4cfe3e23d488926cf09a8c0ccc68b70446bbd8ceda652
FossilOrigin-Name: a23d3b50fd7c2013d83f868a3a4114880887ec8fb6e9917b43c243607caab67c
the RTREE extension.

FossilOrigin-Name: f567ea96905ec58bb073b675e820ba505d3306338fdefd64bdd5cf965a3a9e88
…-2147483648 as a parameter.

FossilOrigin-Name: 127b3270f8716e0eda06ea6979def88283e15aecdceb5d56c82105b300c98bdc
…ve, add "sqlite3_config(SQLITE_CONFIG_MEMSTATUS, 1);" to fuzzcheck.c.

FossilOrigin-Name: 10e11b9c539a8be50fd93bdf7cf5afe97d9757ce8577cac58426a1b218063e47
FossilOrigin-Name: b270f8339eb13b504d0b2ba154ebca966b7dde08e40c3ed7d559749818cb2075
the zipfile extension.

FossilOrigin-Name: 325c222726f275f14c1cbf82fc8ee4e60d07e87daaaa9674d050d1e82f85902c
FossilOrigin-Name: b39e8eb7ca8509df428916118df6fcb7d064d73f7d73b1a54f486127b90447c3
FossilOrigin-Name: 492c3a07dea5953e7197abb1098169c2c2126936f97f4b7e8a45d1c7f31ebfa1
fossildelta extension.  This code is not used in the SQLite core.

FossilOrigin-Name: 1f4e32e2e3985d2ccb56c87794f04557bc451e2d75b28667908d3dc6842678a2
Not part of any standard deliverable.  
[forum:/forumpost/d41879b367c7f7ec|Forum thread d41879b367c7f7ec].

FossilOrigin-Name: 693c90a7aa33f2c3cee978773c614ccc7830633341bf53924e84a21c7e28b091
…lete mode from a strategically corrupted fts5 database.

FossilOrigin-Name: 3a24bf9374a04822505ef6db29374a107956c27a70fe5f6c2b468f8df8466dd4
…rapping around to the start of the wal file.

FossilOrigin-Name: 5aadfbbdd83b051b5f4a3f06eb60cf9b37aa1d62e676584719e6f785ecf148c7
FossilOrigin-Name: 6ca269b677c6cdc03628fc4f3634ee1b9b956170f9bc41ba8d37b15cc6571a88
FossilOrigin-Name: 737ae4a34738ffa0c3ff7f9bb18df914dd1cad163f28fd6b6e114a344fe6d618
@azizcodesthings azizcodesthings force-pushed the codex/update-sqlite-3.51.3 branch 10 times, most recently from d927fbf to b2800e8 Compare May 18, 2026 02:39
Update libsql-sqlite3 to SQLite 3.51.3 and regenerate the bundled libsql-ffi artifacts.

Restore libSQL compatibility across Makefile targets, legacy wasm configure flags, reserved-byte and encrypted replica behavior, vector VACUUM/integrity/FLOAT8 behavior, Tcl harness compatibility, WAL restart test cleanup, CRR reset ordering, and extension CI lockfile coverage.
@azizcodesthings azizcodesthings force-pushed the codex/update-sqlite-3.51.3 branch from b2800e8 to b05e22b Compare May 18, 2026 03:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant