Skip to content

Show grants using more than two roles return incorrect result #30855

@xuanyu66

Description

@xuanyu66

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

CREATE DATABASE IF NOT EXISTS tispark_test;
CREATE TABLE IF NOT EXISTS tispark_test.table_test(i int, s varchar(128));
CREATE ROLE IF NOT EXISTS 'test_read', 'test_write';
GRANT SELECT ON tispark_test.table_test TO 'test_read'@'%';
GRANT UPDATE ON tispark_test.table_test TO 'test_write'@'%';
CREATE USER IF NOT EXISTS 'tispark_unit_test_user' IDENTIFIED BY '';
GRANT 'test_read','test_write' TO 'tispark_unit_test_user'@'%';
SHOW GRANTS FOR 'tispark_unit_test_user'@'%' USING 'test_read','test_write';

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

MySQL version: 8.0.27
image

3. What did you see instead (Required)

image

Actually, if I use command SET ROLE 'test_read', 'test_write', it still can select rows from table tispark_test.table_test. So I think it's a bug for SHOW GRANTS

4. What is your TiDB version? (Required)

TiDB version:5.3.0
image

Metadata

Metadata

Assignees

Labels

affects-5.0This bug affects 5.0.x versions.affects-5.1This bug affects 5.1.x versions.affects-5.2This bug affects 5.2.x versions.affects-5.3This bug affects 5.3.x versions.affects-5.4This bug affects the 5.4.x(LTS) versions.good first issueDenotes an issue ready for a new contributor, according to the "help wanted" guidelines.help wantedDenotes an issue that needs help from a contributor. Must meet "help wanted" guidelines.severity/majorsig/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