Bug #105137 CREATE INDEX change a table name to lowercase
Submitted: 5 Oct 2021 14:53 Modified: 11 Oct 2021 12:29
Reporter: Stefan Kusnir Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server Severity:S2 (Serious)
Version:8.0.23 OS:Windows (Win64)
Assigned to: CPU Architecture:Any (Win64)

[5 Oct 2021 14:53] Stefan Kusnir
Description:
When you create an index on table in uppercase, after update the table name is converted to lowercase.

How to repeat:
SHOW VARIABLES LIKE 'lower_case_%';
Variable_name           Value   
----------------------  --------
lower_case_file_system  ON      
lower_case_table_names  2       

SHOW VARIABLES LIKE 'version%';
Variable_name            Value                         
-----------------------  ------------------------------
version                  8.0.23                        
version_comment          MySQL Community Server - GPL  
version_compile_machine  x86_64                        
version_compile_os       Win64                         
version_compile_zlib     1.2.11                        

CREATE DATABASE `MYSQL_TEST` CHARACTER SET UTF8MB4 COLLATE utf8mb4_general_ci;
USE `MYSQL_TEST`;

CREATE TABLE `TEST_TABLE` (
  `id` INT NOT NULL AUTO_INCREMENT,
  `status` ENUM('s1','s2','s3') NOT NULL DEFAULT 's1',
  PRIMARY KEY (`id`)
) ENGINE=INNODB DEFAULT CHARSET=UTF8MB4;

ALTER TABLE `TEST_TABLE` ADD KEY `status1` (`status`);
# OK, keep table name TEST_TABLE
CREATE INDEX `status2` ON `TEST_TABLE` (`status`);
# FAILED, change table name to test_table
ALTER TABLE `TEST_TABLE` ADD KEY `status3` (`status`);
# OK, change table name to TEST_TABLE

Suggested fix:
The table name should by the same like before change or like as given.
[11 Oct 2021 12:29] MySQL Verification Team
Hello Stefan Kusnir,

Thank you for the bug report.
Imho this is duplicate of Bug #48875, please see Bug #48875.

Regards,
Ashwini Patil