Will using /*T![auto_rand] AUTO_RANDOM(5) */ directly in create table not create auto_random?

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) */不会创建auto_random?

| username: lindoubled

TiDB Version: v5.3.0

Question 1: As follows:

Question 2:
Using dumpling and lightning for export and import, auto_random is also gone.

| username: WalterWj | Original post link

Feels like a bug :thinking:

| username: 啦啦啦啦啦 | Original post link

Please provide the table creation statement, and I’ll give it a try.

| username: lindoubled | Original post link

tidb version: v5.3.0

CREATE TABLE `log_mobile_ones1` (
  `id` bigint(11) NOT NULL /*T![auto_rand] AUTO_RANDOM(5) */,
  `mobile` varchar(255) NOT NULL DEFAULT '',
  `app_id` varchar(255) DEFAULT NULL,
  `uuid` varchar(255) DEFAULT '',
  `data` json DEFAULT NULL,
  `send_at` timestamp NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`) /*T![clustered_index] CLUSTERED */,
  KEY `idx_mobile` (`mobile`),
  KEY `idx_app_id` (`app_id`),
  KEY `idx_send_at` (`send_at`),
  KEY `idx_uuid` (`uuid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin
| username: 啦啦啦啦啦 | Original post link

I tested it and there was no problem. I suspect that your client version is relatively low, try adding --comments when logging in.

| username: lindoubled | Original post link

The above content was exported using dumpling and then imported using lightning. The lightning import also does not have auto_random.

| username: lindoubled | Original post link

The client is MySQL 8.0.30.

| username: lindoubled | Original post link

The image is not visible. Please provide the text you need translated.

| username: 啦啦啦啦啦 | Original post link

Did you add --comments when logging in?

| username: lindoubled | Original post link

Adding --comments is fine.

| username: lindoubled | Original post link

However, there are still issues with Dumpling and Lightning.

| username: 啦啦啦啦啦 | Original post link

This might be a bug with dumpling. I tested it on version 5.3 and it indeed doesn’t work, but exporting with TiDB version 6.1 works fine.

| username: lindoubled | Original post link

Okay, we will take a look at how to solve it on our end. Thank you, thank you.

| username: Lucien-卢西恩 | Original post link

Please use the latest version of the tool. It is backward compatible by default and also resolves long-standing bugs.

| username: system | Original post link

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