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

executor: add column character sets when show create table #8866

Merged
merged 20 commits into from
Jan 14, 2019

Conversation

AndrewDi
Copy link
Contributor

@AndrewDi AndrewDi commented Dec 28, 2018

What problem does this PR solve?

Fix bug #8700

What is changed and how it works?

When show create table, the character sets of the non-default columns should be retained.

Check List

Tests

  • Unit test

This change is Reviewable

@AndrewDi AndrewDi changed the title executor: add column character sets where show create table executor: add column character sets when show create table Dec 28, 2018
Copy link
Contributor

@winkyao winkyao left a comment

Choose a reason for hiding this comment

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

LGTM

@zz-jason
Copy link
Member

@AndrewDi Please fix CI

@zz-jason zz-jason added status/LGT1 Indicates that a PR has LGTM 1. contribution This PR is from a community contributor. sig/execution SIG execution labels Dec 28, 2018
@AndrewDi
Copy link
Contributor Author

/run-all-tests

@codecov-io
Copy link

codecov-io commented Jan 4, 2019

Codecov Report

Merging #8866 into master will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #8866      +/-   ##
==========================================
+ Coverage   67.27%   67.27%   +<.01%     
==========================================
  Files         371      371              
  Lines       75917    75919       +2     
==========================================
+ Hits        51073    51076       +3     
+ Misses      20345    20343       -2     
- Partials     4499     4500       +1
Impacted Files Coverage Δ
executor/show.go 41.65% <100%> (+0.18%) ⬆️
ddl/delete_range.go 74.28% <0%> (-5.72%) ⬇️
executor/distsql.go 73% <0%> (+0.46%) ⬆️
expression/schema.go 94.95% <0%> (+0.84%) ⬆️
store/tikv/lock_resolver.go 42.65% <0%> (+0.94%) ⬆️
executor/join.go 79.48% <0%> (+1.55%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 00c4ff4...4c8aea7. Read the comment docs.

@@ -571,6 +571,9 @@ func (e *ShowExec) fetchShowCreateTable() error {
var hasAutoIncID bool
for i, col := range tb.Cols() {
fmt.Fprintf(&buf, " %s %s", escape(col.Name, sqlMode), col.GetTypeDesc())
if col.Charset != "binary" {
Copy link
Member

Choose a reason for hiding this comment

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

why don't we print the "binary" charset and collation?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Because MySQL didn't do it either, and it will broken lots of test case...

Copy link
Member

Choose a reason for hiding this comment

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

OK, this behavior is confirmed in a mysql server on my laptop:

MySQL(root@localhost:test) > create table t(a char(10) character set binary, b char(20) character set utf8mb4);
Query OK, 0 rows affected (0.03 sec)

MySQL(root@localhost:test) > show create table t\G
*************************** 1. row ***************************
       Table: t
Create Table: CREATE TABLE `t` (
  `a` binary(10) DEFAULT NULL,
  `b` char(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
1 row in set (0.00 sec)

@zz-jason
Copy link
Member

zz-jason commented Jan 5, 2019

/run-all-tests

Copy link
Member

@zz-jason zz-jason left a comment

Choose a reason for hiding this comment

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

LGTM

@zz-jason zz-jason added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Jan 5, 2019
@zz-jason
Copy link
Member

zz-jason commented Jan 7, 2019

The integration test is failed, some modifications should be made to correct these test cases.

@winkyao
Copy link
Contributor

winkyao commented Jan 14, 2019

/run-all-tests

@winkyao
Copy link
Contributor

winkyao commented Jan 14, 2019

/run-all-tests

@winkyao
Copy link
Contributor

winkyao commented Jan 14, 2019

/run-all-tests tidb-test=pr/718

@winkyao
Copy link
Contributor

winkyao commented Jan 14, 2019

/run-common-test tidb-test=pr/718

@winkyao
Copy link
Contributor

winkyao commented Jan 14, 2019

/run-integration-common-test tidb-test=pr/718

2 similar comments
@winkyao
Copy link
Contributor

winkyao commented Jan 14, 2019

/run-integration-common-test tidb-test=pr/718

@winkyao
Copy link
Contributor

winkyao commented Jan 14, 2019

/run-integration-common-test tidb-test=pr/718

@lysu
Copy link
Contributor

lysu commented Jan 14, 2019

/run-common-test tidb-test=pr/718

3 similar comments
@lysu
Copy link
Contributor

lysu commented Jan 14, 2019

/run-common-test tidb-test=pr/718

@lysu
Copy link
Contributor

lysu commented Jan 14, 2019

/run-common-test tidb-test=pr/718

@winkyao
Copy link
Contributor

winkyao commented Jan 14, 2019

/run-common-test tidb-test=pr/718

@lysu
Copy link
Contributor

lysu commented Jan 14, 2019

/run-common-test tidb-test=pr/718
/run-integration-common-test tidb-test=pr/718

2 similar comments
@lysu
Copy link
Contributor

lysu commented Jan 14, 2019

/run-common-test tidb-test=pr/718
/run-integration-common-test tidb-test=pr/718

@lysu
Copy link
Contributor

lysu commented Jan 14, 2019

/run-common-test tidb-test=pr/718
/run-integration-common-test tidb-test=pr/718

@lysu
Copy link
Contributor

lysu commented Jan 14, 2019

/run-all-tests tidb-test=pr/718

@lysu
Copy link
Contributor

lysu commented Jan 14, 2019

/run-unit-test tidb-test=pr/718

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contribution This PR is from a community contributor. sig/execution SIG execution status/LGT2 Indicates that a PR has LGTM 2.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants