-
Notifications
You must be signed in to change notification settings - Fork 5.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
types/json: fix an over-quoted bug in BinaryJSON.Unquote
function
#11934
Conversation
34fcb9f
to
9190621
Compare
Codecov Report
@@ Coverage Diff @@
## master #11934 +/- ##
================================================
- Coverage 81.2155% 81.2099% -0.0056%
================================================
Files 443 443
Lines 95004 95013 +9
================================================
+ Hits 77158 77160 +2
- Misses 12351 12356 +5
- Partials 5495 5497 +2 |
/run-all-tests |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
types/json/binary_functions.go
Outdated
// Remove prefix and suffix '"'. | ||
s, err := unquoteString(tmp[1 : tlen-1]) | ||
if err != nil { | ||
return s, errors.Trace(err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can remove the Trace
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The error is returned by unquoteString
, so I think it is better to use Trace
? @lonng
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bb7133 All errors returned by unquoteString
have been wrapt withTrace
. (anyway, not a strong opinion)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see, thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addressed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rest LGTM
9190621
to
1cf1837
Compare
/run-all-tests |
/run-all-tests |
@bb7133 Do we need to cherry-pick to release branches? |
cherry pick to release-2.1 failed |
cherry pick to release-3.0 in PR #11955 |
@bb7133 Do we need to cherry pick this one to release-3.1 ? |
It seems that, not for sure, we failed to cherry-pick this commit to release-2.1. Please comment '/run-cherry-picker' to try to trigger the cherry-picker if we did fail to cherry-pick this commit before. @bb7133 PTAL. |
/run-cherry-picker |
cherry pick to release-2.1 failed |
Already cherry picked in #12096. |
What problem does this PR solve?
This PR tries to fix the following issue:
In current TiDB(master/3.0/2.1):
In MySQL 5.7/8.0:
What is changed and how it works?
The issue is caused by the over-unquote behaviors of
BinaryJSON.Unquote
: for a string literal of JSON, it should be unquoted only when enclosed by double quotes("
)Check List
Tests
Code changes
Side effects
N/A
Related changes
Release note
Fix an over-quoted bug for
JSON_UNQUOTE
function: only values enclosed by the double quote marks("
) should be unquoted. For example, result ofSELECT JSON_UNQUOTE("\\\\")
should be\\
(not changed).