pingcap / pingcap/tidb

SHOW GRANTS splits table-level and column-level privileges into two GRANT statements

Open
#70,666 2 comments 0 reactions 1 assignee Claimed by @YangKeao View on GitHub
severity/minor sig/sql-infra type/bug
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)

```
CREATE DATABASE grant_output_test;
CREATE TABLE grant_output_test.baz (
id INT,
address VARCHAR(255),
status INT
);
CREATE USER 'grant_output_test'@'%';
GRANT SELECT (address, id, status), INSERT, UPDATE, DELETE ON grant_output_test.baz TO 'grant_output_test'@'%';
SHOW GRANTS FOR 'grant_output_test'@'%';
```

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

MySQL 8.0 merges table-level and column-level privileges for the same table into a single GRANT statement:
```
GRANT SELECT (`address`, `id`, `status`), INSERT, UPDATE, DELETE ON `grant_output_test`.`baz` TO `grant_output_test`@`%`
```

### 3. What did you see instead (Required)

TiDB emits table-level and column-level privileges as two separate GRANT statements:
```
GRANT INSERT, UPDATE, DELETE ON grant_output_test.baz TO 'grant_output_test'@'%'
GRANT SELECT (address, id, status) ON grant_output_test.baz TO 'grant_output_test'@'%'
```

This doesn't match what's stated in the doc.
https://docs.pingcap.com/tidb/stable/sql-statement-show-grants/#mysql-compatibility

### 4. What is your TiDB version? (Required)
v8.5.7

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.