Privileges for INSERT command is incompatible with MySQL
- Dominant language
- Go
- Stars
- 40.5k
- Forks
- 6.2k
- PR merge metrics
- PR metrics pending
Description
## Bug Report
Please answer these questions before submitting your issue. Thanks!
### 1. Minimal reproduce step (Required)
```
-- connect as root
CREATE DATABASE test;
CREATE TABLE test.tbl (x INT, y INT DEFAULT 10);
CREATE USER foo;
GRANT INSERT ON test.tbl TO foo;
-- connect as foo
INSERT INTO test.tbl (x) VALUES (y+y);
```
### 2. What did you expect to see? (Required)
```
MySQL [(none)]> INSERT INTO test.tbl (x) VALUES (y+y);
ERROR 1143 (42000): SELECT command denied to user 'foo'@'%' for column 'y' in table 'tbl'
```
Since MySQL requires `SELECT` privilege for `INSERT INTO test.tbl (x) VALUES (y+y)`, and TiDB is designed to be compatible with MySQL, TiDB should require `SELECT` privilege for this command as well.
### 3. What did you see instead (Required)
```
MySQL [(none)]> INSERT INTO test.tbl (x) VALUES (y+y);
Query OK, 1 row affected (0.001 sec)
```
### 4. What is your TiDB version? (Required)
```
Release Version: v9.0.0-beta.1
Edition: Community
Git Commit Hash: 7aff918dcbfa6facf2adef9ade9961c40f217421
Git Branch: HEAD
UTC Build Time: 2025-03-24 09:09:55
GoVersion: go1.23.7
Race Enabled: false
Check Table Before Drop: false
Store: unistore
```
Contributor guide
Assessment
This issue has not been assessed yet.