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

Multi schema change - add a column and create a index on the column just created raises ERROR 1072 (42000): column does not exist: #45750

Closed
yahonda opened this issue Aug 2, 2023 · 2 comments
Labels
may-affects-5.2 This bug maybe affects 5.2.x versions. may-affects-5.3 This bug maybe affects 5.3.x versions. may-affects-5.4 This bug maybe affects 5.4.x versions. may-affects-6.1 may-affects-6.5 may-affects-7.1 severity/major sig/sql-infra SIG: SQL Infra type/bug The issue is confirmed as a bug.

Comments

@yahonda
Copy link
Member

yahonda commented Aug 2, 2023

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

  1. Startup tiup playground
% tiup playground nightly
  1. Connect to tiup playground cluster
% mysql --comments --host 127.0.0.1 --port 4000 -u root test
  1. Create table and run multiple schema change
CREATE TABLE IF NOT EXISTS delete_me (id bigint NOT NULL AUTO_INCREMENT PRIMARY KEY);
ALTER TABLE delete_me ADD name varchar(255), ADD INDEX index_delete_me_on_name (name);

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

ALTER TABLE delete_me ADD name varchar(255), ADD INDEX index_delete_me_on_name (name) should add name column and add index_delete_me_on_name index as MySQL 8.0.33 does.

mysql> CREATE TABLE IF NOT EXISTS delete_me (id bigint NOT NULL AUTO_INCREMENT PRIMARY KEY);
Query OK, 0 rows affected (0.03 sec)

mysql> ALTER TABLE delete_me ADD name varchar(255), ADD INDEX index_delete_me_on_name (name);
Query OK, 0 rows affected (0.02 sec)
Records: 0  Duplicates: 0  Warnings: 0

mysql> show create table delete_me\G
*************************** 1. row ***************************
       Table: delete_me
Create Table: CREATE TABLE `delete_me` (
  `id` bigint NOT NULL AUTO_INCREMENT,
  `name` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `index_delete_me_on_name` (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
1 row in set (0.00 sec)

mysql> select version();
+-----------+
| version() |
+-----------+
| 8.0.33    |
+-----------+
1 row in set (0.00 sec)

3. What did you see instead (Required)

ALTER TABLE delete_me ADD name varchar(255), ADD INDEX index_delete_me_on_name (name) gets ERROR 1072 (42000): column does not exist: name.

mysql> CREATE TABLE IF NOT EXISTS delete_me (id bigint NOT NULL AUTO_INCREMENT PRIMARY KEY);
Query OK, 0 rows affected (0.12 sec)

mysql> ALTER TABLE delete_me ADD name varchar(255), ADD INDEX index_delete_me_on_name (name);
ERROR 1072 (42000): column does not exist: name

mysql> select tidb_version()\G
*************************** 1. row ***************************
tidb_version(): Release Version: v7.3.0-alpha
Edition: Community
Git Commit Hash: fc906e745ac2ed5ed2a152894d2e7229c3f05ac0
Git Branch: heads/refs/tags/v7.3.0-alpha
UTC Build Time: 2023-08-01 14:25:46
GoVersion: go1.20.6
Race Enabled: false
Check Table Before Drop: false
Store: tikv
1 row in set (0.00 sec)

mysql>

4. What is your TiDB version? (Required)

mysql> select tidb_version()\G
*************************** 1. row ***************************
tidb_version(): Release Version: v7.3.0-alpha
Edition: Community
Git Commit Hash: fc906e745ac2ed5ed2a152894d2e7229c3f05ac0
Git Branch: heads/refs/tags/v7.3.0-alpha
UTC Build Time: 2023-08-01 14:25:46
GoVersion: go1.20.6
Race Enabled: false
Check Table Before Drop: false
Store: tikv
1 row in set (0.00 sec)

mysql>
@yahonda yahonda added the type/bug The issue is confirmed as a bug. label Aug 2, 2023
@ti-chi-bot ti-chi-bot bot added may-affects-5.2 This bug maybe affects 5.2.x versions. may-affects-5.3 This bug maybe affects 5.3.x versions. may-affects-5.4 This bug maybe affects 5.4.x versions. may-affects-6.1 may-affects-6.5 may-affects-7.1 labels Aug 2, 2023
@bb7133
Copy link
Member

bb7133 commented Aug 2, 2023

Hi @yahonda , this is a known limitation(not implemented yet), it duplicates with #38897.

I'm going to close this issue if you're OK with it.

@yahonda
Copy link
Member Author

yahonda commented Aug 3, 2023

Thanks for the update. Closing this issue as a duplicate.

@yahonda yahonda closed this as completed Aug 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
may-affects-5.2 This bug maybe affects 5.2.x versions. may-affects-5.3 This bug maybe affects 5.3.x versions. may-affects-5.4 This bug maybe affects 5.4.x versions. may-affects-6.1 may-affects-6.5 may-affects-7.1 severity/major sig/sql-infra SIG: SQL Infra type/bug The issue is confirmed as a bug.
Projects
None yet
Development

No branches or pull requests

3 participants