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

table, infoschema, executor: fix Charset/Collation shown in column desc #10007

Merged
merged 4 commits into from Apr 9, 2019

Conversation

Projects
None yet
5 participants
@bb7133
Copy link
Contributor

bb7133 commented Apr 2, 2019

What problem does this PR solve?

With the help of a parser PR(pingcap/parser#270), this request aims to fix:

  1. Collate descriptions displayed in SHOW FULL COLUMNS statement. It will: close #9807, close #9837.

  2. Some corner cases in information_schema.COLUMNS table, take the following statements as instance:

mysql> create table t1(a tinytext);
Query OK, 0 rows affected (0.08 sec)

In MySQL 5.7:

mysql> SELECT column_name, character_set_name, collation_name FROM information_schema.COLUMNS WHERE table_schema = "test" AND table_name = "t1";
+-------------+--------------------+--------------------+
| column_name | character_set_name | collation_name     |
+-------------+--------------------+--------------------+
| a           | utf8mb4            | utf8mb4_general_ci |
+-------------+--------------------+--------------------+
1 row in set (0.03 sec)

In TiDB master before this PR:

mysql> SELECT column_name, character_set_name, collation_name FROM information_schema.COLUMNS WHERE table_schema = "test" AND table_name = "t1";
+-------------+--------------------+----------------+
| column_name | character_set_name | collation_name |
+-------------+--------------------+----------------+
| a           | NULL               | NULL           |
+-------------+--------------------+----------------+
1 row in set (0.01 sec)

What is changed and how it works?

It used a HasCharset() function ported from MySQL source and use it to determine if given column's Charset/Collation should be displayed, following the way MySQL does:

sql_show.cc::store_column_type()

Check List

Tests

  • Integration test

Code changes

  • Has interface methods change

Side effects

  • Increased code complexity

Related changes

  • Need to cherry-pick to the release branch

@bb7133 bb7133 force-pushed the bb7133:bb7133/fix_show_column branch from b9ce58a to de338af Apr 2, 2019

@xiekeyi98
Copy link
Contributor

xiekeyi98 left a comment

  1. TODO && FIXME, I think use one of them is enough.
  2. Maybe we should delete or change the mysql-test.
Show resolved Hide resolved executor/show_test.go Outdated
Show resolved Hide resolved infoschema/tables_test.go Outdated
@xiekeyi98

This comment has been minimized.

Copy link
Contributor

xiekeyi98 commented Apr 3, 2019

/run-all-tests

@bb7133 bb7133 force-pushed the bb7133:bb7133/fix_show_column branch from de338af to 425490b Apr 4, 2019

@bb7133

This comment has been minimized.

Copy link
Contributor Author

bb7133 commented Apr 4, 2019

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

@codecov

This comment has been minimized.

Copy link

codecov bot commented Apr 4, 2019

Codecov Report

Merging #10007 into master will decrease coverage by 0.0673%.
The diff coverage is 100%.

@@               Coverage Diff               @@
##            master     #10007        +/-   ##
===============================================
- Coverage   78.033%   77.9657%   -0.0674%     
===============================================
  Files          404        404                
  Lines        81996      81995         -1     
===============================================
- Hits         63984      63928        -56     
- Misses       13316      13354        +38     
- Partials      4696       4713        +17
@ngaut

This comment has been minimized.

Copy link
Member

ngaut commented Apr 4, 2019

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

@bb7133 bb7133 force-pushed the bb7133:bb7133/fix_show_column branch from fbbcecd to 0b966f1 Apr 8, 2019

@bb7133

This comment has been minimized.

Copy link
Contributor Author

bb7133 commented Apr 8, 2019

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

@bb7133

This comment has been minimized.

Copy link
Contributor Author

bb7133 commented Apr 9, 2019

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

@xiekeyi98
Copy link
Contributor

xiekeyi98 left a comment

LGTM

Show resolved Hide resolved executor/show_test.go Outdated
Show resolved Hide resolved table/column.go Outdated

@bb7133 bb7133 force-pushed the bb7133:bb7133/fix_show_column branch from ba884b4 to 0a19d05 Apr 9, 2019

@bb7133

This comment has been minimized.

Copy link
Contributor Author

bb7133 commented Apr 9, 2019

Addressed, thanks @zimulala

@zimulala
Copy link
Member

zimulala left a comment

LGTM

@zimulala

This comment has been minimized.

Copy link
Member

zimulala commented Apr 9, 2019

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

@zimulala zimulala added status/LGT2 and removed status/LGT1 labels Apr 9, 2019

@xiekeyi98 xiekeyi98 merged commit f723f0b into pingcap:master Apr 9, 2019

13 of 14 checks passed

continuous-integration/travis-ci/pr The Travis CI build is in progress
Details
ci/circleci Your tests passed on CircleCI!
Details
idc-jenkins-ci-tidb/build Jenkins job succeeded.
Details
idc-jenkins-ci-tidb/check_dev Jenkins job succeeded.
Details
idc-jenkins-ci-tidb/code_coverage Jenkins job succeeded.
Details
idc-jenkins-ci-tidb/common-test job succeeded
Details
idc-jenkins-ci-tidb/integration-common-test Jenkins job succeeded.
Details
idc-jenkins-ci-tidb/integration-compatibility-test Jenkins job succeeded.
Details
idc-jenkins-ci-tidb/integration-ddl-test Jenkins job succeeded.
Details
idc-jenkins-ci-tidb/mybatis-test job succeeded
Details
idc-jenkins-ci-tidb/sqllogic-test-1 Jenkins job succeeded.
Details
idc-jenkins-ci-tidb/sqllogic-test-2 Jenkins job succeeded.
Details
idc-jenkins-ci-tidb/unit-test Jenkins job succeeded.
Details
license/cla Contributor License Agreement is signed.
Details
@tshqin

This comment has been minimized.

Copy link
Member

tshqin commented Apr 10, 2019

need a cherry pick to 2.1 branch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.