Skip to content

GRANT is not case insensitive in GRANT SELECT ON tablename #34610

@espresso98

Description

@espresso98

Bug Report

1. Minimal reproduce step

DROP DATABASE IF EXISTS d1; 

CREATE DATABASE d1;
USE d1;
CREATE USER user_1@localhost;
CREATE TABLE T1(f1 INT);
CREATE TABLE t1(f1 INT);
GRANT SELECT ON T1 to user_1@localhost;
GRANT SELECT ON t1 to user_1@localhost;

DROP DATABASE d1;
DROP USER user_1@localhost;

2. What did you expect to see?

mysql> CREATE TABLE T1(f1 INT);
Query OK, 0 rows affected (0.01 sec)

mysql> CREATE TABLE t1(f1 INT);
ERROR 1050 (42S01): Table 't1' already exists

mysql> GRANT SELECT ON T1 to user_1@localhost;
Query OK, 0 rows affected (0.00 sec)

mysql> GRANT SELECT ON t1 to user_1@localhost;
Query OK, 0 rows affected (0.00 sec)

3. What did you see instead

tidb> CREATE TABLE T1(f1 INT);
Query OK, 0 rows affected (0.00 sec)

tidb> CREATE TABLE t1(f1 INT);
ERROR 1050 (42S01): Table 'd1.t1' already exists

tidb> GRANT SELECT ON T1 to user_1@localhost;
Query OK, 0 rows affected (0.01 sec)

tidb> GRANT SELECT ON t1 to user_1@localhost;  -- not case insesitive, Table 'd1.t1' already exists
ERROR 1146 (42S02): Table 'd1.t1' doesn't exist     

4. What is your TiDB version?

tidb_version(): Release Version: v6.1.0-alpha-391-g901f042d5
Edition: Community
Git Commit Hash: 901f042d5d3cca6c52e8d4921e109b2b6f14f594
Git Branch: master
UTC Build Time: 2022-05-12 03:19:29
GoVersion: go1.18.1
Race Enabled: false
TiKV Min Version: v3.0.0-60965b006877ca7234adaced7890d7b029ed1306
Check Table Before Drop: false

Metadata

Metadata

Assignees

Labels

affects-5.4This bug affects the 5.4.x(LTS) versions.affects-6.1This bug affects the 6.1.x(LTS) versions.may-affects-5.0This bug maybe affects 5.0.x versions.may-affects-5.1This bug maybe affects 5.1.x versions.may-affects-5.2This bug maybe affects 5.2.x versions.may-affects-5.3This bug maybe affects 5.3.x versions.may-affects-6.0severity/moderatesig/sql-infraSIG: SQL Infratype/bugThe issue is confirmed as a bug.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions