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

show create table should fail when the user only has create temporary table privilege #29281

Open
djshow832 opened this issue Oct 31, 2021 · 0 comments
Labels
severity/moderate sig/sql-infra SIG: SQL Infra type/bug The issue is confirmed as a bug.

Comments

@djshow832
Copy link
Contributor

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

mysql -h127.1 -uroot -P4000

mysql> create database tmpdb;
Query OK, 0 rows affected (0.01 sec)

mysql> create table tmpdb.t(id int);
Query OK, 0 rows affected (0.01 sec)

mysql> drop user test_user;
Query OK, 0 rows affected (0.01 sec)

mysql> create user test_user;
Query OK, 0 rows affected (0.01 sec)

mysql> grant create temporary tables on tmpdb.* to test_user;
Query OK, 0 rows affected (0.00 sec)
mysql -h127.1 -utest_user -P4000

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| INFORMATION_SCHEMA |
| tmpdb              |
+--------------------+
2 rows in set (0.00 sec)

mysql> use tmpdb;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> show tables;
+-----------------+
| Tables_in_tmpdb |
+-----------------+
| t               |
+-----------------+
1 row in set (0.00 sec)

mysql> show create table t;
+-------+------------------------------------------------------------------------------------------------------------+
| Table | Create Table                                                                                               |
+-------+------------------------------------------------------------------------------------------------------------+
| t     | CREATE TABLE `t` (
  `id` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin |
+-------+------------------------------------------------------------------------------------------------------------+
1 row in set (0.01 sec)

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

mysql -h127.1 -utest_user -Ac

mysql> use tmpdb;
Database changed
mysql> show tables;
Empty set (0.01 sec)

mysql> show create table t;
ERROR 1142 (42000): SHOW command denied to user 'test_user'@'localhost' for table 't'

3. What did you see instead (Required)

mysql -h127.1 -utest_user -P4000

mysql> use tmpdb;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> show tables;
+-----------------+
| Tables_in_tmpdb |
+-----------------+
| t               |
+-----------------+
1 row in set (0.00 sec)

mysql> show create table t;
+-------+------------------------------------------------------------------------------------------------------------+
| Table | Create Table                                                                                               |
+-------+------------------------------------------------------------------------------------------------------------+
| t     | CREATE TABLE `t` (
  `id` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin |
+-------+------------------------------------------------------------------------------------------------------------+
1 row in set (0.01 sec)

4. What is your TiDB version? (Required)

master

@djshow832 djshow832 added type/bug The issue is confirmed as a bug. severity/moderate labels Oct 31, 2021
@ChenPeng2013 ChenPeng2013 added the sig/sql-infra SIG: SQL Infra label Nov 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
severity/moderate sig/sql-infra SIG: SQL Infra type/bug The issue is confirmed as a bug.
Projects
None yet
Development

No branches or pull requests

2 participants