Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Grantor column in mysql.tables_priv is always NULL #38293

Closed
mikecaat opened this issue Oct 4, 2022 · 1 comment · Fixed by #38461
Closed

Grantor column in mysql.tables_priv is always NULL #38293

mikecaat opened this issue Oct 4, 2022 · 1 comment · Fixed by #38461
Assignees
Labels
affects-4.0 This bug affects 4.0.x versions. affects-5.0 This bug affects 5.0.x versions. affects-5.1 This bug affects 5.1.x versions. affects-5.2 This bug affects 5.2.x versions. affects-5.3 This bug affects 5.3.x versions. affects-5.4 This bug affects 5.4.x versions. affects-6.0 affects-6.1 affects-6.2 affects-6.3 severity/minor sig/sql-infra SIG: SQL Infra type/bug The issue is confirmed as a bug.

Comments

@mikecaat
Copy link

mikecaat commented Oct 4, 2022

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)
@mikecaat mikecaat added the type/bug The issue is confirmed as a bug. label Oct 4, 2022
@CbcWestwolf
Copy link
Member

/assign

@xhebox xhebox added affects-4.0 This bug affects 4.0.x versions. affects-5.0 This bug affects 5.0.x versions. affects-5.1 This bug affects 5.1.x versions. affects-5.2 This bug affects 5.2.x versions. affects-5.3 This bug affects 5.3.x versions. affects-5.4 This bug affects 5.4.x versions. affects-6.0 affects-6.1 affects-6.2 affects-6.3 labels Oct 20, 2022
@VelocityLight VelocityLight added may-affects-5.0 This bug maybe affects 5.0.x versions. affects-5.0 This bug affects 5.0.x versions. and removed affects-5.0 This bug affects 5.0.x versions. may-affects-5.0 This bug maybe affects 5.0.x versions. labels Oct 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects-4.0 This bug affects 4.0.x versions. affects-5.0 This bug affects 5.0.x versions. affects-5.1 This bug affects 5.1.x versions. affects-5.2 This bug affects 5.2.x versions. affects-5.3 This bug affects 5.3.x versions. affects-5.4 This bug affects 5.4.x versions. affects-6.0 affects-6.1 affects-6.2 affects-6.3 severity/minor sig/sql-infra SIG: SQL Infra type/bug The issue is confirmed as a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants