Skip to content

Commit

Permalink
*: tiny update
Browse files Browse the repository at this point in the history
  • Loading branch information
zimulala committed Jan 4, 2022
1 parent 01f4725 commit 7c358cc
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
4 changes: 2 additions & 2 deletions TOC.md
Original file line number Diff line number Diff line change
Expand Up @@ -539,8 +539,8 @@
- [分区表](/partitioned-table.md)
- [临时表](/temporary-tables.md)
- 字符集和排序
- [字符集和排序规则](/character-set-and-collation.md)
- [GBK 字符集](/charset-set-gbk.md)
- [字符集和排序规则](/character-set-and-collation.md)
- [GBK 字符集](/character-set-gbk.md)
- [Placement Rules in SQL](/placement-rules-in-sql.md)
- 系统表
- [`mysql`](/mysql-schema.md)
Expand Down
19 changes: 12 additions & 7 deletions character-set-gbk.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,40 +56,42 @@ SHOW COLLATION WHERE CHARSET = 'gbk';
* 在设置成 `character_set_client = gbk``character_set_connection = utf8mb4``character_set_table = gbk` 的情况下,TiDB 处理非法字符的情况与 MySQL 兼容。
* 当设置 `names``gbk` 后 TiDB 处理非法字符的情况与 MySQL 有一些不一样。具体行为如下(其中 `insert` 语句所在表的建表语句:`create table gbk_table(a varchar(32) character set gbk);`):

| DB | SQL_Mode | (Compatible) | (Imcompatible) |
|---------|----------------------|--------------------------------------|--------------------------------------|
```sql
+---------+----------------------+--------------------------------------+--------------------------------------+
| | | character_set_client = gbk <br> | character_set_client = gbk |
| / | / | character_set_connection = utf8mb4 | character_set_connection = gbk |
| DB | SQL_Mode | character_set_connection = utf8mb4 | character_set_connection = gbk |
| | | character_set_table = gbk | character_set_client = gbk |
| | | (Compatible) | (Imcompatible) |
|---------|----------------------|--------------------------------------|--------------------------------------|
+---------+----------------------+--------------------------------------+--------------------------------------+
| MySQL | STRICT_ALL_TABLES or | select hex('一a') (0xe4b88061) | select hex('一a') (0xe4b88061) |
| | STRICT_TRANS_TABLES | e6b6933f | e4b88061 |
| | | | |
| | | insert into gbk_table values('一a'); | insert into gbk_table values('一a'); |
| | | select hex(a) from gbk_table; | Incorrect Error |
| | | e4b83f | |
|---------|----------------------|--------------------------------------|--------------------------------------|
+---------+----------------------+--------------------------------------+--------------------------------------+
| TiDB | STRICT_ALL_TABLES or | select hex('一a') (0xe4b88061) | select hex('一a') (0xe4b88061) |
| | STRICT_TRANS_TABLES | e6b6933f | Incorrect Error |
| | | | |
| | | insert into gbk_table values('一a'); | insert into gbk_table values('一a'); |
| | | select hex(a) from gbk_table; | Incorrect Error |
| | | e4b83f | |
|---------|----------------------|--------------------------------------|--------------------------------------|
+---------+----------------------+--------------------------------------+--------------------------------------+
| MySQL | not include | select hex('一a') (0xe4b88061) | select hex('一a') (0xe4b88061) |
| | STRICT_ALL_TABLES or | e6b6933f | e4b88061 |
| | STRICT_TRANS_TABLES | | |
| | | insert into gbk_table values('一a'); | insert into gbk_table values('一a'); |
| | | select hex(a) from gbk_table; | select hex(a) from gbk_table; |
| | | e4b83f | e4b8 |
|---------|----------------------|--------------------------------------|--------------------------------------|
+---------+----------------------+--------------------------------------+--------------------------------------+
| TiDB | not include | select hex('一a') (0xe4b88061) | select hex('一a') (0xe4b88061) |
| | STRICT_ALL_TABLES or | e6b6933f | e4b83f |
| | STRICT_TRANS_TABLES | | |
| | | insert into gbk_table values('一a'); | insert into gbk_table values('一a'); |
| | | select hex(a) from gbk_table; | select hex(a) from gbk_table; |
| | | e4b83f | e4b83f |
+---------+----------------------+--------------------------------------+--------------------------------------+
```



Expand All @@ -106,3 +108,6 @@ SHOW COLLATION WHERE CHARSET = 'gbk';
ERROR 1115 (42000): Unsupported character introducer: 'gbk'
```

## 其他组件兼容性

* 目前不支持此功能的组件包括:TiCDC 和 TiFlash。

0 comments on commit 7c358cc

Please sign in to comment.