[MDEV-22536] Dropping the default role will not drop the record in mysql.user table Created: 2020-05-12  Updated: 2023-04-27

Status: Open
Project: MariaDB Server
Component/s: Authentication and Privilege System
Affects Version/s: 10.1, 10.2, 10.3, 10.4, 10.5
Fix Version/s: 10.4

Type: Bug Priority: Major
Reporter: Anel Husakovic Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None


 Description   

Dropping the default role will not drop the record in mysql.user table.
Is this by design or bug?

MariaDB [(none)]> CREATE ROLE y;
Query OK, 0 rows affected (0.00 sec)
 
MariaDB [(none)]> SELECT * FROM INFORMATION_SCHEMA.APPLICABLE_ROLES;
+----------------+-----------+--------------+------------+
| GRANTEE        | ROLE_NAME | IS_GRANTABLE | IS_DEFAULT |
+----------------+-----------+--------------+------------+
| root@localhost | x         | YES          | YES        |
| root@localhost | y         | YES          | NO         |
+----------------+-----------+--------------+------------+
2 rows in set (0.00 sec)
 
MariaDB [(none)]> SET DEFAULT ROLE y;
Query OK, 0 rows affected (0.00 sec)
 
MariaDB [(none)]> SELECT default_role FROM mysql.user WHERE user='root';
+--------------+
| default_role |
+--------------+
| y            |
|              |
|              |
|              |
+--------------+
4 rows in set (0.00 sec)
 
MariaDB [(none)]> DROP ROLE y;
Query OK, 0 rows affected (0.00 sec)
 
# Default role is still there in mysql.user table ?
MariaDB [(none)]> SELECT default_role FROM mysql.user WHERE user='root';
+--------------+
| default_role |
+--------------+
| y            |
|              |
|              |
|              |
+--------------+
4 rows in set (0.00 sec)
 
MariaDB [(none)]> # After dropping the role and creating it again it will stay as default
MariaDB [(none)]> CREATE ROLE y;
Query OK, 0 rows affected (0.00 sec)
 
MariaDB [(none)]> SELECT * FROM INFORMATION_SCHEMA.APPLICABLE_ROLES;
+----------------+-----------+--------------+------------+
| GRANTEE        | ROLE_NAME | IS_GRANTABLE | IS_DEFAULT |
+----------------+-----------+--------------+------------+
| root@localhost | x         | YES          | NO         |
| root@localhost | y         | YES          | YES        |
+----------------+-----------+--------------+------------+
2 rows in set (0.00 sec)



 Comments   
Comment by Elena Stepanova [ 2020-08-02 ]

You've set the component to "Tests". Did you mean that some MTR tests are affected by it? If so, which are?

Comment by Anel Husakovic [ 2020-08-02 ]

No, I worked on different patch and created a test where I found this, so Tests in context means bug is covered with test case in jira.

Generated at Thu Feb 08 09:15:29 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.