Executable comments in `create table` with `autorandom` are invalid

This topic has been translated from a Chinese forum by GPT and might contain errors.

Original topic: create table 中 autorandom 的可执行注释无效

| username: Holland

【TiDB Usage Environment】Production Environment
【TiDB Version】
【Reproduction Path】Operations performed that led to the issue
Created a table according to the official documentation AUTO_RANDOM | PingCAP 文档中心

【Encountered Issue: Problem Phenomenon and Impact】
auto random is not working

【Resource Configuration】Enter TiDB Dashboard - Cluster Info - Hosts and take a screenshot of this page
【Attachments: Screenshots/Logs/Monitoring】

| username: zhanggame1 | Original post link

Insert a few pieces of data to see if they are random.

| username: tidb菜鸟一只 | Original post link

I have no issues here.

| username: 我是咖啡哥 | Original post link

When connecting to the database, add --comments or -c, otherwise comments will be ignored.

mysql -h1XXX -P4000 --comments -uroot -pxxx test

CREATE TABLE t (a bigint /*T![auto_rand] AUTO_RANDOM */, b VARCHAR(255), PRIMARY KEY (a));
Query OK, 0 rows affected, 1 warning (0.10 sec)

show create table t\G
*************************** 1. row ***************************
       Table: t
Create Table: CREATE TABLE `t` (
  `a` bigint(20) NOT NULL /*T![auto_rand] AUTO_RANDOM(5) */,
  `b` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`a`) /*T![clustered_index] CLUSTERED */
1 row in set (0.01 sec)
| username: Holland | Original post link


| username: system | Original post link

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.