Skip to content

Grantor column in mysql.tables_priv is always NULL #38293

@mikecaat

Description

@mikecaat

Bug Report

Thanks for watching the issue. I find the Grantor column in mysql.tables_priv is always NULL although in case of MySQL it has a value. Is it expected behavior?

1. Minimal reproduce step (Required)

CREATE USER test;
GRANT SELECT ON `mysql`.`db` TO test;
SELECT * FROM `mysql`.`tables_priv`;

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

Grantor column have the grantor name for example root@localhost.

MySQL [(none)]> SELECT * FROM `mysql`.`tables_priv`;
+------+-------+------+------------+---------+---------------------+------------+-------------+
| Host | DB    | User | Table_name | Grantor | Timestamp           | Table_priv | Column_priv |
+------+-------+------+------------+---------+---------------------+------------+-------------+
| %    | mysql | test | db         | ******* | 2022-10-04 11:20:37 | Select     | Select      |
+------+-------+------+------------+---------+---------------------+------------+-------------+
1 row in set (0.02 sec)

Note that the results of MySQL 5.7.39 is the following.

mysql> SELECT * FROM `mysql`.`tables_priv`;
+-----------+-------+---------------+------------+----------------------+---------------------+------------+-------------+
| Host      | Db    | User          | Table_name | Grantor              | Timestamp           | Table_priv | Column_priv |
+-----------+-------+---------------+------------+----------------------+---------------------+------------+-------------+
| localhost | mysql | mysql.session | user       | boot@connecting host | 0000-00-00 00:00:00 | Select     |             |
| localhost | sys   | mysql.sys     | sys_config | root@localhost       | 2022-10-04 02:43:35 | Select     |             |
| %         | mysql | test          | db         | root@localhost       | 0000-00-00 00:00:00 | Select     |             |
+-----------+-------+---------------+------------+----------------------+---------------------+------------+-------------+
3 rows in set (0.00 sec)

3. What did you see instead (Required)

The value of Grantor column is NULL.

MySQL [(none)]> SELECT * FROM `mysql`.`tables_priv`;
+------+-------+------+------------+---------+---------------------+------------+-------------+
| Host | DB    | User | Table_name | Grantor | Timestamp           | Table_priv | Column_priv |
+------+-------+------+------------+---------+---------------------+------------+-------------+
| %    | mysql | test | db         |         | 2022-10-04 11:20:37 | Select     | Select      |
+------+-------+------+------------+---------+---------------------+------------+-------------+
1 row in set (0.02 sec)

4. What is your TiDB version? (Required)

MySQL [(none)]> select tidb_version();
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| tidb_version()                                                                                                                                                                                                                                                                                                       |
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Release Version: v6.1.1
Edition: Community
Git Commit Hash: 5263a0abda61f102122735049fd0dfadc7b7f8b2
Git Branch: heads/refs/tags/v6.1.1
UTC Build Time: 2022-08-25 10:42:41
GoVersion: go1.18.5
Race Enabled: false
TiKV Min Version: v3.0.0-60965b006877ca7234adaced7890d7b029ed1306
Check Table Before Drop: false |
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions