Repository navigation
Upgrade SQLite to version 3.54.1 - #8239
Conversation
Rebase the row-count and early-completion patches. Adapt completion to SQLite's new sqlite3_incomplete() scanner, keeping its status result separate from the byte-count API. Remove the internal-function restriction and default-expression authorizer patches, whose fixes are now included upstream. Revert SQLite 3.54.1's new `OP_ClrSubtype` emission for scalar subqueries. This preserves legacy subtype propagation, allowing outer JSON functions to embed scalar-subquery results as JSON rather than quoting them as strings. This will be added back with a compatibility flag.
There was a problem hiding this comment.
💬 Approved with comments — The upgrade is mechanical and the rebased patches look correct. There is one open question: does 3.54.1 already fix the json_each lifetime issue that the removed patch 0007 addressed? The other notes are optional.
Findings: 1 question · 1 info · 1 suggestion (2 are inline comments on the diff)
The decision is advisory: this review is a comment and never approves, blocks or requests changes on the pull request.
📋 Code Quality: ❓ 1 question · 1 info · 1 suggestion
Patch 0007 is removed without a stated reason, the subtype revert has no test, and the revert also changes a shared helper.
Recommendation: 📝 Minor Comments
- [QUESTION] Patch 0007 (json_each root as SQLITE_TRANSIENT) is removed, but the description does not say 3.54.1 includes that fix. Please confirm upstream json.c no longer returns the root with SQLITE_STATIC, or restore the patch. (
MODULE.bazel:19) - [INFO] No regression test pins the legacy scalar-subquery subtype propagation this patch preserves. (
patches/sqlite/0005-legacy-subquery-subtypes.patch:6) - [SUGGESTION] Removing TK_AGG_FUNCTION changes the shared sqlite3ExprCanReturnSubtype helper, not only the OP_ClrSubtype emission site. (
patches/sqlite/0005-legacy-subquery-subtypes.patch:31)
View full review
- Question: Patch
0007-json-each-root-transient.patchis dropped. It changed json_each's root column result fromSQLITE_STATICtoSQLITE_TRANSIENT, so the result could not point intop->path.zBufafter that buffer is reused or freed. The description says only the 0005 and 0006 fixes are now upstream and does not mention 0007. Please confirm that 3.54.1'ssrc/json.cmakes this safe, or restore the patch.json_eachis reachable from Worker SQL. - The new
0005-legacy-subquery-subtypes.patchintentionally reverts upstream behaviour, but no test pins it. A test that nests a JSON-subtyped scalar subquery insidejson_object/json_arraywould catch a later upgrade silently dropping the patch. It would also give the planned compatibility flag a baseline. - The same patch removes
TK_AGG_FUNCTIONfromsqlite3ExprCanReturnSubtype, so every caller of that helper in 3.54.1 changes, not only theOP_ClrSubtypeemission site.
✅ All other checks passed
🚀 Release: ✅ LGTM
Version, URL and sha256 are updated consistently. Risk: low.
🔒 Security: ✅ LGTM
The rebased sqlite3Incomplete/sqlite3_complete_length patch sets pLength on every exit path and returns a length only when the scan reports a complete statement. The memory-safety question about removing the json_each patch is in the code quality section.
📖 AGENTS.md: ✅ LGTM
No AGENTS.md concerns.
⚡ Performance: ✅ LGTM
No performance concerns.
📝 Documentation: ✅ LGTM
No documentation concerns.
Reviewed commit: 8cd68e7b
SQLite was declared by hand, so builds that include gen/shared_deps.MODULE.bazel had to keep their own copy, which fell out of sync with #8239. Define it in shared_deps.jsonc instead, from SQLite's official GitHub mirror: https://www.sqlite.org/whynotgit.html#the_official_github_mirror The mirror has tags but no GitHub releases, so github_release gains tag_regex. The version stays frozen. Bazel's built-in patcher now applies the patches, so 0003 and 0004 get the diff lines it needs. To update SQLite: rebase patches/sqlite/ as its README describes, set freeze_version in shared_deps.jsonc, and run just update-deps sqlite3.
SQLite was declared by hand, so builds that include gen/shared_deps.MODULE.bazel had to keep their own copy, which fell out of sync with #8239. Define it in shared_deps.jsonc instead, from SQLite's official GitHub mirror: https://www.sqlite.org/whynotgit.html#the_official_github_mirror The mirror has tags but no GitHub releases, so github_release gains tag_regex. The version stays frozen. Bazel's built-in patcher now applies the patches, so 0003, 0004 and 0006 get the diff lines it needs. To update SQLite: rebase patches/sqlite/ as its README describes, set freeze_version in shared_deps.jsonc, and run just update-deps sqlite3.
SQLite was declared by hand, so builds that include gen/shared_deps.MODULE.bazel had to keep their own copy, which fell out of sync with #8239. Define it in shared_deps.jsonc instead, from SQLite's official GitHub mirror: https://www.sqlite.org/whynotgit.html#the_official_github_mirror The mirror has tags but no GitHub releases, so github_release gains tag_regex. The version stays frozen. Bazel's built-in patcher now applies the patches, so 0003, 0004 and 0006 get the diff lines it needs. To update SQLite: rebase patches/sqlite/ as its README describes, set freeze_version in shared_deps.jsonc, and run just update-deps sqlite3.
Rebase the row-count and early-completion patches. Adapt completion to SQLite's new sqlite3_incomplete() scanner, keeping its status result separate from the byte-count API.
Remove the internal-function restriction and default-expression authorizer patches, whose fixes are now included upstream.
Revert SQLite 3.54.1's new
OP_ClrSubtypeemission for scalar subqueries. This preserves legacy subtype propagation, allowing outer JSON functions to embed scalar-subquery results as JSON rather than quoting them as strings. This will be added back with a compatibility flag.