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

The "show create table" command is incorrect, when "character_set_results = GBK" and it has illegal characters #31338

Closed
zimulala opened this issue Jan 5, 2022 · 1 comment · Fixed by #35822
Assignees
Labels
severity/moderate sig/sql-infra SIG: SQL Infra type/bug The issue is confirmed as a bug.

Comments

@zimulala
Copy link
Contributor

zimulala commented Jan 5, 2022

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

set character_set_results = gbk;

create table t(f set(0xD2BB, 0xC8FD), e enum(0xBAEC,0x6A59));
show create table t;
drop table t;
create table t( e enum(0xBAEC,0x6A59));
show create table t;

2. What did you expect to see? (Required)

mysql>  show create table t;
+-------+----------------------------------------------------------------------------------------------------------------------------------------------------------+
| Table | Create Table                                                                                                                                             |
+-------+----------------------------------------------------------------------------------------------------------------------------------------------------------+
| t     | CREATE TABLE `t` (
  `f` set('?','?') DEFAULT NULL,
  `e` enum('?','jY') DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci |
+-------+----------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.01 sec)

mysql> show create table t;
+-------+-------------------------------------------------------------------------------------------------------------------------+
| Table | Create Table                                                                                                            |
+-------+-------------------------------------------------------------------------------------------------------------------------+
| t     | CREATE TABLE `t` (
  `e` enum('?','jY') DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci |
+-------+-------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)

3. What did you see instead (Required)

tidb> show create table t;
+-------+--------------------------------+
| Table | Create Table                   |
+-------+--------------------------------+
| t     | CREATE TABLE `t` (
  `f` set(' |
+-------+--------------------------------+
1 row in set (0.01 sec)

tidb> show create table t;
+-------+---------------------------------+
| Table | Create Table                    |
+-------+---------------------------------+
| t     | CREATE TABLE `t` (
  `e` enum(' |
+-------+---------------------------------+
1 row in set (0.01 sec)

4. What is your TiDB version? (Required)

| Release Version: v5.5.0-alpha-27-g9acb2c2ad-dirty
Edition: Community
Git Commit Hash: 9acb2c2ad5a3891fd9fb9de27befb986bcc243a7
Git Branch: master
UTC Build Time: 2022-01-05 08:16:38
@zimulala zimulala added type/bug The issue is confirmed as a bug. sig/sql-infra SIG: SQL Infra labels Jan 5, 2022
@tangenta
Copy link
Contributor

tangenta commented Feb 9, 2022

This is because the binary literal like 0xD2BB in enum/set can only be decoded to utf8mb4. When the result is written back to the client, an error occurs because 0xD2BB cannot be encoded with gbk. Thus, the result is truncated.

I think we cannot solve this problem until we find a way to decode the binary literal correctly from enum/set.

you06 added a commit to you06/tidb that referenced this issue Jul 1, 2022
Signed-off-by: you06 <[email protected]>

fix tests

Signed-off-by: you06 <[email protected]>

fix test

Signed-off-by: you06 <[email protected]>

update

Signed-off-by: you06 <[email protected]>

update bazel

Signed-off-by: you06 <[email protected]>

fix test

Signed-off-by: you06 <[email protected]>

fix test

Signed-off-by: you06 <[email protected]>

update

Signed-off-by: you06 <[email protected]>

update client-go

Signed-off-by: you06 <[email protected]>

update client-go

Signed-off-by: you06 <[email protected]>

update grafana

Signed-off-by: you06 <[email protected]>

update bazel

Signed-off-by: you06 <[email protected]>

display by stack

Signed-off-by: you06 <[email protected]>

set request source for ctx of

Signed-off-by: you06 <[email protected]>

address comment

Signed-off-by: you06 <[email protected]>

address comment

Signed-off-by: you06 <[email protected]>

parser, ddl: support decoding binary literal in set/enum (pingcap#35822)

close pingcap#31338

executor: fix a nil point when @@tidb_enable_collect_execution_info is off and cop cache is on (pingcap#35839)

close pingcap#35829

ddl: support drop columns for multi-schema change (pingcap#35737)

ref pingcap#14766

planner: don't push down predicates over table dual (pingcap#35669)

close pingcap#35527

*: Remove some useless staleness code (pingcap#35849)

close pingcap#35848

ddl: fix potential wrong column definition when setting default value (pingcap#35845)

close pingcap#35846

*: add timeout for test cases (pingcap#35844)

ddl: remove `onDropColumns` and `onAddColumns` (pingcap#35862)

ref pingcap#14766

*: Fix Dockerfile (pingcap#35835)

close pingcap#35828

server: refactor TestConnExecutionTimeout (pingcap#35865)

close pingcap#35868

fix test

Signed-off-by: you06 <[email protected]>

fix lint

Signed-off-by: you06 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
severity/moderate sig/sql-infra SIG: SQL Infra type/bug The issue is confirmed as a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants