ddl : fix column collate should use table's if it has when create table or alter table.#13119
Conversation
Codecov Report
@@ Coverage Diff @@
## master #13119 +/- ##
===========================================
Coverage ? 80.7511%
===========================================
Files ? 468
Lines ? 114417
Branches ? 0
===========================================
Hits ? 92393
Misses ? 15134
Partials ? 6890 |
|
/rebuild |
|
/run-unit-test |
ddl/db_change_test.go
Outdated
| if job.SchemaState != model.StatePublic { | ||
| result := tk.MustQuery("show create table t") | ||
| var result *testkit.Result | ||
| if job.Query[12:14] == "t2" { |
There was a problem hiding this comment.
How about use t2 := testGetTableByName(c, tk.Se, "test", "t2") then compare the job.TableID == t2.Meta().ID
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
ddl/db_change_test.go
Outdated
| if job.SchemaState != model.StatePublic { | ||
| result := tk.MustQuery("show create table t") | ||
| var result *testkit.Result | ||
| if job.Query[12:14] == "t2" { |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
| } | ||
|
|
||
| return tableCharset | ||
| return tableCharset, tableCollate |
There was a problem hiding this comment.
I think using two loops is more expressive when there is little impact on the performance.
There was a problem hiding this comment.
there is one loop with two if judgment.
|
/run-all-tests |
|
this pr need fix mysql_test as well |
|
/run-common-test |
|
/run-integration-common-test |
|
cherry pick to release-3.0 in PR #13174 |
|
cherry pick to release-3.1 in PR #13175 |
|
cherry pick to release-2.1 failed |
|
|
||
| func findTableOptionCharset(options []*ast.TableOption) string { | ||
| var tableCharset string | ||
| func findTableOptionCharsetAndCollate(options []*ast.TableOption) (tableCharset, tableCollate string) { |
There was a problem hiding this comment.
Please use this function instead:
Line 1841 in aaaf254
I think we can remove findTableOptionCharsetAndCollate
…le or alter table. (pingcap#13119) fix column's collation should use table's collation
…le or alter table. (pingcap#13119) fix column's collation should use table's collation
|
It seems that, not for sure, we failed to cherry-pick this commit to release-2.1 release-3.0. Please comment '/run-cherry-picker' to try to trigger the cherry-picker if we did fail to cherry-pick this commit before. @AilinKid PTAL. |
What problem does this PR solve?
fix issue #13113
When creating a table, if we set a collate for this table, all columns in this table should use this collate instead of using default collates.
In MySQL:
In TiDB
What is changed and how it works?
Table's collate should be passed into
buildColumnsAndConstraintswhen increate table or alter table.Check List
Tests
Code changes
buildColumnsAndConstraintsfunction.Related changes
Release note