|
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.
|