[MDEV-33110] HANDLER commands are case insensitive with lower-case-table-names=0 Created: 2023-12-22  Updated: 2024-01-19

Status: Open
Project: MariaDB Server
Component/s: Character Sets
Affects Version/s: 10.4, 11.4
Fix Version/s: 10.4, 11.4

Type: Bug Priority: Major
Reporter: Alexander Barkov Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None

Issue Links:
Relates
relates to MDEV-31340 Remove MY_COLLATION_HANDLER::strcasec... In Review

 Description   

I execute this SQL script with a Linux MariaDB server running with --lower-case-table-names=0:

CREATE OR REPLACE TABLE t1 (a INT);
INSERT INTO t1 VALUES (1),(2);
HANDLER t1 OPEN;
HANDLER t1 READ FIRST;
CREATE OR REPLACE TABLE T1 (a INT);
DROP TABLE T1;
HANDLER t1 READ NEXT;

ERROR 1109 (42S02): Unknown table 't1' in HANDLER

The above looks wrong. This command should return the second record from `t1`.

The problem is in this code fragment in mysql_ha_find_match() in sql_handler.cc:

      if ((! tables->db.str[0] ||
          ! my_strcasecmp(&my_charset_latin1, hash_tables->db.str,
                          tables->get_db_name())) &&
          ! my_strcasecmp(&my_charset_latin1, hash_tables->table_name.str,
                          tables->get_table_name()))

It compares table and db names in case insensitive style. Also, it erroneously uses latin1 as a character set.


Generated at Thu Feb 08 10:36:27 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.