Repository navigation
fix(jsonb): quote JSONPath names that would not read back - #11756
Merged
Xuanwo merged 2 commits intoDec 2, 2026
Merged
Conversation
Display for Path wrote DotField, ColonField and ObjectField names and PathValue string literals verbatim. A name containing a raw-name delimiter rendered as text that parses to a different path (`$."a.b"` printed as `$.a.b`) or does not parse at all, so a parsed path and its text were no longer the same path. The golden file pinned one such rendering. Write a name unquoted only when it reads back unchanged, and always write object fields and string literals as escaped double-quoted strings. This is what databendlabs/jsonb does today. Display only; no persisted bytes change. ## How was this patch tested `test_json_path_display_round_trip` re-parses the rendered text and compares it with the original path. The golden `json_path.txt` line for `$."st\"ore"."book…"` now renders quoted.
Xuanwo
approved these changes
Dec 2, 2026
Contributor
Author
|
Thanks @Xuanwo |
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.
Closes #11755.
Display for Pathwrote DotField, ColonField and ObjectField names, and PathValue string literals, verbatim. A name containing a raw-name delimiter rendered as text that parses to a different path:$."a.b"printed as$.a.b, which is two fields;$."st\"ore"printed as$.st"ore, which does not parse. The golden file had the wrong output pinned.A name is now written without quotes only when every character reads back unchanged. Names that contain a delimiter, whitespace, a backslash, or a control character are written as a double-quoted string with
\"/\\/\uXXXXescaping. Object fields and string literals are always quoted. databendlabs/jsonb formats them the same way. No persisted bytes change.How was this patch tested
test_json_path_display_round_tripre-parses the rendered text of four paths that contain delimiters and embedded quotes and asserts the round-trip produces the same parsed path. Thejson_path.txtgolden line for$."st\"ore"."book💎"now renders with the first field quoted.🤖 Generated with Claude Opus