-
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
ddl: fix alter table charset bug and compatibility #9790
ddl: fix alter table charset bug and compatibility #9790
Conversation
Codecov Report
@@ Coverage Diff @@
## master #9790 +/- ##
================================================
- Coverage 78.0083% 77.9959% -0.0125%
================================================
Files 404 404
Lines 81954 82012 +58
================================================
+ Hits 63931 63966 +35
- Misses 13329 13341 +12
- Partials 4694 4705 +11 |
/run-all-tests |
/run-unit-test |
…20/tidb into fix-alter-table-charset
/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
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
LGTM |
ddl/ddl_api.go
Outdated
if collates[i] == "" { | ||
return "", "", ErrUnknownCollation.GenWithStackByArgs("") | ||
} | ||
} | ||
collate = collates[len(collates)-1] |
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.
It seems that we need to check all collates.
mysql> alter table t charset utf8 collate utf8_bin collate utf8_bin collate utf8mb4_bin;
ERROR 1253 (42000): COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'utf8'
mysql> alter table t charset utf8 collate utf8_bin collate utf8mb4_bin collate utf8_bin;
ERROR 1253 (42000): COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'utf8'
…20/tidb into fix-alter-table-charset
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
/run-all-tests |
What problem does this PR solve?
In MySQL
In TiDB
The table charset maybe "" cause create in the old TiDB version(such as 2.0.8), then execute alter table charset will return error, But it should execute successfully.
Some behaver is not compatible with MySQL.
In MySQL
In TiDB v2.0.8
In TiDB master,
What is changed and how it works?
Change AlterTableCharsetAndCollate func.
Check List
Tests
Code changes
Side effects
Related changes