-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
Error message of duplicate primary key was not showing as expected, error message has been rectified #38254
Conversation
close #38170 <!-- Thank you for contributing to TiDB! PR Title Format: 1. pkg [, pkg2, pkg3]: what's changed 2. *: what's changed --> ### What problem does this PR solve? <!-- Please create an issue first to describe the problem. There MUST be one line starting with "Issue Number: " and linking the relevant issues via the "close" or "ref". For more info, check https://pingcap.github.io/tidb-dev-guide/contribute-to-tidb/contribute-code.html#referring-to-an-issue. --> Issue Number: close #35289 Problem Summary: ### What is changed and how it works? This PR modfies the **rune type strings** into **unicode style strings** as it was asked in the relevant issue ### Check List Tests <!-- At least one of them must be included. --> I have done the unit tests using `make gotest` - [ x ] Unit test - [ ] Integration test - [ ] Manual test (add detailed scripts or steps below) - [ ] No code Side effects - [ ] Performance regression: Consumes more CPU - [ ] Performance regression: Consumes more Memory - [ ] Breaking backward compatibility Documentation - [ ] Affects user behaviors - [ ] Contains syntax changes - [ x ] Contains variable changes - [ ] Contains experimental features - [ ] Changes MySQL compatibility ### Release note <!-- compatibility change, improvement, bugfix, and new feature need a release note --> Please refer to [Release Notes Language Style Guide](https://pingcap.github.io/tidb-dev-guide/contribute-to-tidb/release-notes-style-guide.html) to write a quality release note. ```release-note None ```
[REVIEW NOTIFICATION] This pull request has not been approved. To complete the pull request process, please ask the reviewers in the list to review by filling The full list of commands accepted by this bot can be found here. Reviewer can indicate their review by submitting an approval review. |
Welcome @measutosh! |
/cc @tangenta, here is a submission from my side to solve the issue - #35289 Here I have made a small demo of simillar code - go playground Please have a look on it. 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.
Hi, can you add an unit test to illustrate the effects?
Hi @lance6716 , I am quite new to this, unable to figure out how to write test case for this |
Maybe you can search for the usage of |
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.
For the ASCII characters we don't have to cast to "%u" style.
return genKeyExistsError(name, strings.Join(valueStr, "-"), nil) | ||
var nonUnicodeValueStr []string; | ||
for i := 0; i < len(valueStr); i++ { | ||
nonUnicodeValueStr[i] = fmt.Sprintf("\\u%X", valueStr[i]) |
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.
This assignment will panic because of the index-out-of-range error.
Co-authored-by: tangenta <tangenta@126.com>
[FORMAT CHECKER NOTIFICATION] Notice: To remove the 📖 For more info, you can check the "Contribute Code" section in the development guide. |
What problem does this PR solve?
Issue Number: close #35289
Problem Summary:
What is changed and how it works?
This PR modfies the rune type strings into unicode style strings as it was asked in the relevant issue
Check List
Tests
I have done the unit tests using
make gotest
Side effects
Documentation
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.