Skip to content

Grant SELECT and INSERT to non-existent table should report an error #29268

@djshow832

Description

@djshow832

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

This is really confusing in MySQL:
When granting ALTER, or INSERT, CREATE privileges, it works, see #28533
However, when granting INSERT or SELECT, it doesn't work.

mysql> drop table if exists tmpdb.t1;
Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql> grant select on tmpdb.t1 to test_user;
Query OK, 0 rows affected (0.18 sec)

mysql> grant insert on tmpdb.t1 to test_user;
Query OK, 0 rows affected (0.18 sec)

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

mysql> drop table if exists tmpdb.t1;
Query OK, 0 rows affected, 1 warning (0.01 sec)

mysql> grant select on tmpdb.t1 to test_user;
ERROR 1146 (42S02): Table 'tmpdb.t1' doesn't exist
mysql> grant insert on tmpdb.t1 to test_user;
ERROR 1146 (42S02): Table 'tmpdb.t1' doesn't exist

3. What did you see instead (Required)

mysql> drop table if exists tmpdb.t1;
Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql> grant select on tmpdb.t1 to test_user;
Query OK, 0 rows affected (0.18 sec)

mysql> grant insert on tmpdb.t1 to test_user;
Query OK, 0 rows affected (0.18 sec)

4. What is your TiDB version? (Required)

Release Version: None
Edition: Community
Git Commit Hash: None
Git Branch: None
UTC Build Time: None
GoVersion: go1.16.4
Race Enabled: false
TiKV Min Version: v3.0.0-60965b006877ca7234adaced7890d7b029ed1306
Check Table Before Drop: false

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions