TiDB 6.0 sql 返回信息 bug?

Bug 反馈
清晰准确地描述您发现的问题,提供任何可能复现问题的步骤有助于研发同学及时处理问题
【 TiDB 版本】
TiDB-v6.0.0
【 Bug 的影响】
返回的错误信息有误

【可能的问题复现步骤】
基础数据:

> show create table users\G
*************************** 1. row ***************************
       Table: users
Create Table: CREATE TABLE `users` (
  `id` bigint(20) NOT NULL,
  `balance` decimal(15,2) DEFAULT '0.0',
  `nickname` varchar(100) NOT NULL,
  PRIMARY KEY (`id`) /*T![clustered_index] CLUSTERED */,
  UNIQUE KEY `nickname` (`nickname`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin
1 row in set (0.001 sec)

INSERT INTO `bookshop`.`users` (`id`, `balance`, `nickname`) VALUES (1, 0.00, 'nicky');

错误复现:

$ tidb
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MySQL connection id is 425
Server version: 5.7.25-TiDB-v6.0.0 TiDB Server (Apache License 2.0) Community Edition, MySQL 5.7 compatible

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

tidb-v6> use bookshop
Database changed
tidb-v6> INSERT INTO `bookshop`.`users` (`id`, `balance`, `nickname`) VALUES (1, 0.00, 'nicky');
ERROR 1062 (23000): Duplicate entry 'nicky' for key 'nickname'
tidb-v6>
tidb-v6> show create users\G
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your TiDB version for the right syntax to use line 1 column 17 near "users"
Error (Code 1062): Duplicate entry 'nicky' for key 'nickname'

【看到的非预期行为】

tidb-v6> show create users\G
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your TiDB version for the right syntax to use line 1 column 17 near "users"
Error (Code 1062): Duplicate entry 'nicky' for key 'nickname'

【期望看到的行为】
只应返回第一行错误信息

tidb-v6> show create users\G
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your TiDB version for the right syntax to use line 1 column 17 near "users"

【相关组件及具体版本】

【其他背景信息或者截图】
如集群拓扑,系统和内核版本,应用 app 信息等;如果问题跟 SQL 有关,请提供 SQL 语句和相关表的 Schema 信息;如果节点日志存在关键报错,请提供相关节点的日志内容或文件;如果一些业务敏感信息不便提供,请留下联系方式,我们与您私下沟通。

问题已反馈

收到,谢谢表妹~~ :wink:

我的是正常的 mysql> show create table users\G;
*************************** 1. row ***************************
Table: users
Create Table: CREATE TABLE users (
id bigint(20) NOT NULL,
balance decimal(15,2) DEFAULT ‘0.0’,
nickname varchar(100) NOT NULL,
PRIMARY KEY (id) /*T![clustered_index] CLUSTERED */,
UNIQUE KEY nickname (nickname)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin
1 row in set (0.01 sec)

ERROR:
No query specified

mysql> show create users\G;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your TiDB version for the right syntax to use line 1 column 17 near “users”
ERROR:
No query specified

mysql> INSERT INTO users (id, balance, nickname) VALUES (1, 0.00, ‘nicky’);
ERROR 1062 (23000): Duplicate entry ‘nicky’ for key ‘nickname’
mysql> show create users\G;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your TiDB version for the right syntax to use line 1 column 17 near “users”
ERROR:
No query specified

mysql> select version();
±-------------------+
| version() |
±-------------------+
| 5.7.25-TiDB-v6.0.0 |
±-------------------+
1 row in set (0.03 sec)

mysql>

建议换 MySQL client 试试

查看表结构应该是 show create table吧

额,这里的重点是报错信息

ok, 明天试试不同版本的client

mariadb client 会出这个问题,mysql 没有,奇怪了。

此话题已在最后回复的 1 分钟后被自动关闭。不再允许新回复。