Skip to content

Upgrade SQLite to version 3.54.1 - #8239

Merged
zeebo merged 1 commit into
mainfrom
jwendling/upgrade-sqli-icvspm
Nov 5, 2026
Merged

zeebo merged 1 commit into
mainfrom
jwendling/upgrade-sqli-icvspm

Conversation

@zeebo

@zeebo zeebo commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

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.

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.
@zeebo
zeebo requested review from a team as code owners November 5, 2026 17:47

@clanky-the-clanker clanky-the-clanker Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💬 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.patch is dropped. It changed json_each's root column result from SQLITE_STATIC to SQLITE_TRANSIENT, so the result could not point into p->path.zBuf after 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's src/json.c makes this safe, or restore the patch. json_each is reachable from Worker SQL.
  • The new 0005-legacy-subquery-subtypes.patch intentionally reverts upstream behaviour, but no test pins it. A test that nests a JSON-subtyped scalar subquery inside json_object/json_array would catch a later upgrade silently dropping the patch. It would also give the planned compatibility flag a baseline.
  • The same patch removes TK_AGG_FUNCTION from sqlite3ExprCanReturnSubtype, so every caller of that helper in 3.54.1 changes, not only the OP_ClrSubtype emission 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

@zeebo
zeebo merged commit ccf7051 into main Nov 5, 2026
23 checks passed
@zeebo
zeebo deleted the jwendling/upgrade-sqli-icvspm branch November 5, 2026 19:52
KirillTim added a commit that referenced this pull request Nov 17, 2026
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.
KirillTim added a commit that referenced this pull request Nov 17, 2026
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.
KirillTim added a commit that referenced this pull request Nov 17, 2026
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.
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.

2 participants