The /*T![auto_rand] AUTO_RANDOM(5) */ in create table is not parsed by TiDB

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

Original topic: create table 中的 /*T![auto_rand] AUTO_RANDOM(5) */ 不被 TiDB 解析

| username: OnTheRoad

[TiDB Usage Environment] Production Environment
[TiDB Version] v5.3.0, v7.1.1
[Reproduction Path]

  1. Use mysqldump to logically export the schema and table data from v5.3.0.
  2. Use mysql to import the logical backup file generated in Step 1 into v7.1.1.
    [Encountered Issues: Problem Phenomenon and Impact]
  3. The auto_random attribute of the primary key is lost in all tables after restoration.
  4. When executing a table creation statement containing /*T![auto_rand] AUTO_RANDOM(5) */ directly in TiDB 5.3.0 using the navicat tool, AUTO_RANDOM sometimes works and sometimes doesn’t.
    [Resource Configuration]
    [Attachments: Screenshots/Logs/Monitoring]
| username: 脚本小王子 | Original post link

If you use the mysql command for import, you need to add the -c parameter.

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

This is the comment syntax, the link needs to be added with -c.

| username: OnTheRoad | Original post link

When executed in Navicat, auto_random sometimes works and sometimes doesn’t.

| username: dba-kit | Original post link

Similar ones include /*T![clustered_index] CLUSTERED */, /*T![placement] PLACEMENT POLICY=on_sata_new */.

| username: dba-kit | Original post link

It’s easy to miss, but it should be to ensure compatibility with MySQL so that data import to MySQL won’t fail.

| username: zhanggame1 | Original post link

You can migrate data using dumping.