pingcap / pingcap/tidb

show create table behavior differences between TiDB and MySQL when the column has the explicit COLLATE configured

Open
#57,283 4 comments 0 reactions 0 assignees View on GitHub
compatibility-mysql80 severity/minor sig/sql-infra type/bug
Dominant language
Go
Stars
40.5k
Forks
6.2k
PR merge metrics
PR metrics pending

Description

## Bug Report

Please answer these questions before submitting your issue. Thanks!

### 1. Minimal reproduce step (Required)

```sql
create table foo1 (bar varchar(250) COLLATE utf8mb4_bin) DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
show create table foo1\G
```

### 2. What did you expect to see? (Required)
show create table should show the column level COLLATE as MySQL

```sql
mysql> create table foo1 (bar varchar(250) COLLATE utf8mb4_bin) DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
Query OK, 0 rows affected (0.00 sec)
mysql> show create table foo1\G
*************************** 1. row ***************************
Table: foo1
Create Table: CREATE TABLE `foo1` (
`bar` varchar(250) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin
1 row in set (0.00 sec)

mysql> select version();
+-----------+
| version() |
+-----------+
| 8.4.3 |
+-----------+
1 row in set (0.00 sec)
```
### 3. What did you see instead (Required)
The column level collation does not appear at TiDB.

```sql
mysql> create table foo1 (bar varchar(250) COLLATE utf8mb4_bin) DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
Query OK, 0 rows affected (0.07 sec)

mysql> show create table foo1\G
*************************** 1. row ***************************
Table: foo1
Create Table: CREATE TABLE `foo1` (
`bar` varchar(250) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin
1 row in set (0.00 sec)
```

### 4. What is your TiDB version? (Required)

```
mysql> select version();
+--------------------+
| version() |
+--------------------+
| 8.0.11-TiDB-v8.1.0 |
+--------------------+
1 row in set (0.00 sec)
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.