Repository navigation
Conversation
lovasoa
requested changes
Dec 4, 2026
lovasoa
left a comment
Collaborator
There was a problem hiding this comment.
I agree the current situation is not ideal, but I think this moves the issue without really fixing it. We cannot realistically reimplement the entire semantics of SQL, and trying to emulate it more deeply will only make it weirder when someone writes an expression we do not support. I think the real fix is in the documentation, to nudge sqlite users to use jsonb or the json() function by default.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1703
A column such as
CASE WHEN cond THEN json_object(...) ELSE NULL END AS itemwas not recognised as a JSON column, so thecolumnscomponent received it as text and printed the JSON string. A barejson_object(...)was already handled.is_json_expressionnow looks through parentheses, and treats aCASEexpression as JSON when at least one branch is a JSON expression and every other branch is JSON or aNULLliteral. ACASEthat mixes JSON with other values is left as it was.Tests:
projection_partitioning.rsfor the detection (JSON withELSE NULL, parenthesisedCASEwithoutELSE, text withNULL, JSON mixed with text);component_renderingSQL file with aCASEitem. It contains the word "error" inside an unused key, so it fails if the JSON is printed as text. It fails on the previous code and passes with this change.Also added a CHANGELOG entry.
Run on SQLite:
cargo test --lib(256 passed), thesql_test_filestests,cargo fmt --checkandcargo clippy --all-targets. Other databases were not run.