[MDEV-8176] Overuse/misuse of ERROR 1959 (OP000): Invalid role specification Created: 2015-05-18  Updated: 2016-09-02

Status: Open
Project: MariaDB Server
Component/s: Admin statements
Affects Version/s: 10.1
Fix Version/s: 10.1

Type: Bug Priority: Minor
Reporter: Elena Stepanova Assignee: Sergei Golubchik
Resolution: Unresolved Votes: 0
Labels: None

Issue Links:
Relates
relates to MDEV-5164 Testing Roles Closed

 Description   

In some cases ERROR 1959 (OP000): Invalid role specification is very vague and thus annoying. While there should indeed be an error, I suppose it could provide a much better diagnostics.

Example 1

MariaDB [test]> create user foo@localhost;
Query OK, 0 rows affected (0.00 sec)
 
MariaDB [test]> create role r1;
Query OK, 0 rows affected (0.00 sec)
 
MariaDB [test]> set default role r1 for foo@localhost;
ERROR 1959 (OP000): Invalid role specification `r1`.

The real problem is that r1 is not granted to foo, but with "Invalid role specification" one can go mad trying to figure out what's wrong with the specification.

Example 2

MariaDB [test]> create role r1;
Query OK, 0 rows affected (0.00 sec)
 
MariaDB [test]> create role r2;
Query OK, 0 rows affected (0.00 sec)
 
MariaDB [test]> grant r1 to r2;
Query OK, 0 rows affected (0.00 sec)
 
MariaDB [test]> set default role r1 for r2;
ERROR 1959 (OP000): Invalid role specification `r1`.

The real problem is apparently that a role cannot have a default role, but the error complaining about r1 is really confusing here.



 Comments   
Comment by hellwen wu [ 2016-09-02 ]

this is doing:

MariaDB [test]> create role r1;
Query OK, 0 rows affected (0.00 sec)
 
MariaDB [test]> create user u1;
Query OK, 0 rows affected (0.00 sec)
 
MariaDB [test]> set default role r1 for u1;
ERROR 1959 (OP000): Invalid role specification `r1`.
 
MariaDB [test]> grant r1 to u1;
Query OK, 0 rows affected (0.00 sec)
 
MariaDB [test]> set default role r1 for u1;
Query OK, 0 rows affected (0.00 sec)

Generated at Thu Feb 08 07:25:12 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.