Skip to content
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 column collate should use table's if it has when create table or alter table. (#13119 & #12327) #13174

Merged
merged 5 commits into from
Nov 6, 2019

Conversation

sre-bot
Copy link
Contributor

@sre-bot sre-bot commented Nov 6, 2019

cherry-pick #13119 and #12327 to release-3.0


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:

mysql> show create table t;
+-------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Table | Create Table                                                                                                                                                                                                                                 |
+-------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| t     | CREATE TABLE `t` (
  `id` int(11) NOT NULL,
  `c1` varchar(10) COLLATE utf8_slovak_ci DEFAULT NULL,
  `c2` varchar(20) COLLATE utf8_slovak_ci DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_slovak_ci |
+-------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)

In TiDB

mysql> create table t (id int(11) primary key ,c1 varchar(10) ,c2 varchar(20)) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_slovak_ci;
Query OK, 0 rows affected (0.01 sec)

mysql> show create table t;
+-------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Table | Create Table                                                                                                                                                                                                                     |
+-------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| t     | CREATE TABLE `t` (
  `id` int(11) NOT NULL,
  `c1` varchar(10) COLLATE utf8_bin DEFAULT NULL,
  `c2` varchar(20) COLLATE utf8_bin DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_slovak_ci |
+-------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)

What is changed and how it works?

Table's collate should be passed into buildColumnsAndConstraints when in create table or alter table.

Check List

Tests

  • Unit test
  • Integration test

Code changes

  • add parameter for buildColumnsAndConstraints function.

Related changes

  • Need to cherry-pick to the release branch

Release note

  • fix column collate should use table's if it has when create table or alter table.

@sre-bot
Copy link
Contributor Author

sre-bot commented Nov 6, 2019

/run-all-tests

@AilinKid
Copy link
Contributor

AilinKid commented Nov 6, 2019

/run-common-test

@AilinKid
Copy link
Contributor

AilinKid commented Nov 6, 2019

/run-integration-common-test

@AilinKid
Copy link
Contributor

AilinKid commented Nov 6, 2019

/run-all-tests

Copy link
Member

@wjhuang2016 wjhuang2016 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Member

@bb7133 bb7133 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@bb7133 bb7133 added the status/LGT2 Indicates that a PR has LGTM 2. label Nov 6, 2019
@bb7133 bb7133 changed the title ddl : fix column collate should use table's if it has when create table or alter table. (#13119) ddl : fix column collate should use table's if it has when create table or alter table. (#13119 & #12327) Nov 6, 2019
@bb7133 bb7133 added the status/can-merge Indicates a PR has been approved by a committer. label Nov 6, 2019
@sre-bot
Copy link
Contributor Author

sre-bot commented Nov 6, 2019

Sorry @bb7133, you don't have permission to trigger auto merge event on this branch.

@bb7133 bb7133 merged commit 5df9ff5 into pingcap:release-3.0 Nov 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2. type/bugfix This PR fixes a bug.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants