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

compatibility: “show full columns” prints wrong Collation for date, datatime, timestamp columns #9807

Closed
tshqin opened this issue Mar 19, 2019 · 1 comment · Fixed by #10007 or #9810
Assignees

Comments

@tshqin
Copy link
Contributor

tshqin commented Mar 19, 2019

create table t1 (a date,b datetime,c timestamp);
show full columns from t1;

TiDB shows a different collation value ("binary") than mysql(null), this is not a big deal in most cases. It's reported that a CDC software called "Attunity" check the "collation" output of "show full columns" of the tables that managed by itself.
the tool can't pass the db usability check ,pls take a look.

MySQL 5.7.20

+-------+-----------+-----------+------+-----+---------+-------+---------------------------------+---------+
| Field | Type | Collation | Null | Key | Default | Extra | Privileges | Comment |
+-------+-----------+-----------+------+-----+---------+-------+---------------------------------+---------+
| a | date | NULL | YES | | NULL | | select,insert,update,references | |
| b | datetime | NULL | YES | | NULL | | select,insert,update,references | |
| c | timestamp | NULL | YES | | NULL | | select,insert,update,references | |
+-------+-----------+-----------+------+-----+---------+-------+---------------------------------+---------+
3 rows in set (0.00 sec)

TiDB 2.1.6:

+-------+-----------+-----------+------+------+---------+-------+---------------------------------+---------+
| Field | Type | Collation | Null | Key | Default | Extra | Privileges | Comment |
+-------+-----------+-----------+------+------+---------+-------+---------------------------------+---------+
| a | date | binary | YES | | NULL | | select,insert,update,references | |
| b | datetime | binary | YES | | NULL | | select,insert,update,references | |
| c | timestamp | binary | YES | | NULL | | select,insert,update,references | |
+-------+-----------+-----------+------+------+---------+-------+---------------------------------+---------+
3 rows in set (0.01 sec)

Release Version: v2.1.6
Git Commit Hash: 66e639e
Git Branch: HEAD
UTC Build Time: 2019-03-15 09:09:07
GoVersion: go version go1.11.2 linux/amd64
Race Enabled: false
TiKV Min Version: 2.1.0-alpha.1-ff3dd160846b7d1aed9079c389fc188f7f5ea13e
Check Table Before Drop: false

@tshqin
Copy link
Contributor Author

tshqin commented Apr 2, 2019

pls reopen the issue, MySQL prints the nothing 'null', not the character 'NULL'. TiDB prints character 'NULL'.
Can't pass the check of "Attunity" by the same reason.

MySQL 5.7.20

mysql> show full columns from t1 where Collation is null;
+-------+-----------+-----------+------+-----+---------+-------+---------------------------------+---------+
| Field | Type | Collation | Null | Key | Default | Extra | Privileges | Comment |
+-------+-----------+-----------+------+-----+---------+-------+---------------------------------+---------+
| a | date | NULL | YES | | NULL | | select,insert,update,references | |
| b | datetime | NULL | YES | | NULL | | select,insert,update,references | |
| c | timestamp | NULL | YES | | NULL | | select,insert,update,references | |
+-------+-----------+-----------+------+-----+---------+-------+---------------------------------+---------+
3 rows in set (0.00 sec)

mysql> show full columns from t1 where Collation ='NULL';
Empty set (0.00 sec)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment