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

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

Closed
espresso98 opened this issue May 12, 2022 · 4 comments · Fixed by #36778
Closed

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

espresso98 opened this issue May 12, 2022 · 4 comments · Fixed by #36778
Assignees
Labels
affects-5.4 This bug affects 5.4.x versions. affects-6.1 may-affects-5.0 This bug maybe affects 5.0.x versions. may-affects-5.1 This bug maybe affects 5.1.x versions. 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-6.0 severity/moderate sig/sql-infra SIG: SQL Infra type/bug The issue is confirmed as a bug.

Comments

@espresso98
Copy link
Collaborator

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
@espresso98 espresso98 added the type/bug The issue is confirmed as a bug. label May 12, 2022
@espresso98 espresso98 changed the title 'GRANT' is not case insensitive in GRANT SELECT ON tablename GRANT is not case insensitive in GRANT SELECT ON tablename May 12, 2022
@likzn
Copy link
Contributor

likzn commented May 13, 2022

I find the real error happened in CREATE TABLE t1(f1 INT);.Because of the lower_case_table_names.
https://docs.pingcap.com/zh/tidb/dev/mysql-compatibility

Default value of lower_case_table_names:
The default value in TiDB is 2 and currently TiDB only supports 2.
The default value in MySQL:
On Linux: 0
On Windows: 1
On macOS: 2

@ti-chi-bot ti-chi-bot added may-affects-4.0 This bug maybe affects 4.0.x versions. may-affects-5.0 This bug maybe affects 5.0.x versions. may-affects-5.1 This bug maybe affects 5.1.x versions. 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.0 labels May 16, 2022
@seiya-annie seiya-annie added sig/sql-infra SIG: SQL Infra severity/moderate affects-5.4 This bug affects 5.4.x versions. affects-5.0 This bug affects 5.0.x versions. affects-5.1 This bug affects 5.1.x versions. affects-5.2 This bug affects 5.2.x versions. affects-5.3 This bug affects 5.3.x versions. affects-6.0 and removed may-affects-4.0 This bug maybe affects 4.0.x versions. may-affects-5.1 This bug maybe affects 5.1.x versions. 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-5.0 This bug maybe affects 5.0.x versions. may-affects-6.0 severity/moderate affects-5.0 This bug affects 5.0.x versions. affects-5.1 This bug affects 5.1.x versions. affects-5.2 This bug affects 5.2.x versions. labels May 16, 2022
@seiya-annie seiya-annie added may-affects-5.1 This bug maybe affects 5.1.x versions. 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-5.0 This bug maybe affects 5.0.x versions. may-affects-6.0 and removed affects-5.3 This bug affects 5.3.x versions. affects-5.4 This bug affects 5.4.x versions. affects-6.0 labels May 16, 2022
@seiya-annie
Copy link

I find the real error happened in CREATE TABLE t1(f1 INT);.Because of the lower_case_table_names. https://docs.pingcap.com/zh/tidb/dev/mysql-compatibility

Default value of lower_case_table_names:
The default value in TiDB is 2 and currently TiDB only supports 2.
The default value in MySQL:
On Linux: 0
On Windows: 1
On macOS: 2

so, is it not a bug?

@likzn
Copy link
Contributor

likzn commented May 16, 2022

I find the real error happened in CREATE TABLE t1(f1 INT);.Because of the lower_case_table_names. https://docs.pingcap.com/zh/tidb/dev/mysql-compatibility

Default value of lower_case_table_names:
The default value in TiDB is 2 and currently TiDB only supports 2.
The default value in MySQL:
On Linux: 0
On Windows: 1
On macOS: 2

so, is it not a bug?

Miss me, i ignore something.I think it is a bug.

@zimulala
Copy link
Contributor

zimulala commented Jun 1, 2022

PTAL @tiancaiamao

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects-5.4 This bug affects 5.4.x versions. affects-6.1 may-affects-5.0 This bug maybe affects 5.0.x versions. may-affects-5.1 This bug maybe affects 5.1.x versions. 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-6.0 severity/moderate sig/sql-infra SIG: SQL Infra type/bug The issue is confirmed as a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants