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

SHOW CREATE TABLE with clustered primary key does not show AUTO_INCREMENT value when setting AUTO_ID_CACHE=1 #44710

Closed
pcqz opened this issue Jun 15, 2023 · 1 comment

Comments

@pcqz
Copy link

pcqz commented Jun 15, 2023

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

mysql> create table clustered_table(a int auto_increment primary key) auto_id_cache=1;
Query OK, 0 rows affected (0.12 sec)

mysql> insert into clustered_table values(null);
Query OK, 1 row affected (0.01 sec)

mysql> show create table clustered_table;
+-----------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Table           | Create Table                                                                                                                                                                                                                      |
+-----------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| clustered_table | CREATE TABLE `clustered_table` (
  `a` int(11) NOT NULL AUTO_INCREMENT,
  PRIMARY KEY (`a`) /*T![clustered_index] CLUSTERED */
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin /*T![auto_id_cache] AUTO_ID_CACHE=1 */ |
+-----------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)

mysql> show table clustered_table next_row_id;
+---------+-----------------+-------------+--------------------+----------------+
| DB_NAME | TABLE_NAME      | COLUMN_NAME | NEXT_GLOBAL_ROW_ID | ID_TYPE        |
+---------+-----------------+-------------+--------------------+----------------+
| test    | clustered_table | a           |                  1 | _TIDB_ROWID    |
| test    | clustered_table | a           |                  3 | AUTO_INCREMENT |
+---------+-----------------+-------------+--------------------+----------------+
2 rows in set (0.00 sec)

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

I expect to see AUTO_INCREMENT value in the SHOW CREATE TABLE output.

3. What did you see instead (Required)

There is no AUTO_INCREMENT value.

4. What is your TiDB version? (Required)

master

@pcqz pcqz added the type/bug The issue is confirmed as a bug. label Jun 15, 2023
@tiancaiamao
Copy link
Contributor

Fixed by #44743

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants