Details
-
Bug
-
Status: Open (View Workflow)
-
Minor
-
Resolution: Unresolved
-
N/A
-
None
Description
When a user name (or host name) is empty in the user specification for SET SESSION AUTHORIZATION command, ER_NO_SUCH_USER is produced regardless whether the user with the empty value actually exists.
According to set_authorization.test it is expected, but still, it looks strange, so I want to have it at least filed for those who come later wondering.
d4c600f804af677ac3177497b3770dbd67c448f7 |
MariaDB [test]> create or replace user ''@localhost; |
Query OK, 0 rows affected (0.013 sec) |
|
MariaDB [test]> show grants for ''@localhost; |
+--------------------------------------+ |
| Grants for @localhost | |
+--------------------------------------+ |
| GRANT USAGE ON *.* TO ``@`localhost` | |
+--------------------------------------+ |
1 row in set (0.000 sec) |
|
MariaDB [test]> set session authorization ''@localhost; |
ERROR 1449 (HY000): The user ''@'localhost' does not exist |
It would be easier to understand if it were some "not allowed" error, but getting ER_NO_SUCH_USER when the user very clearly exists is just weird.
WIth an empty host it's a bit different, because even though CREATE and GRANT accept the empty host name, they convert it into the wildcard '%', so it could be claimed that SET SESSION AUTHORIZATION doesn't make the adjustment and expects the value to be exact – still a weak argument, but more than one can say for the user name.
MariaDB [test]> create or replace user 'x'@''; |
Query OK, 0 rows affected (0.013 sec) |
|
MariaDB [test]> show grants for 'x'@''; |
+-------------------------------+ |
| Grants for x@% | |
+-------------------------------+ |
| GRANT USAGE ON *.* TO `x`@`%` | |
+-------------------------------+ |
1 row in set (0.000 sec) |
|
MariaDB [test]> set session authorization 'x'@''; |
ERROR 1449 (HY000): The user 'x'@'' does not exist |
A strong argument could be that the SQL standard demands this behavior. I don't have access to the standard to check if it's so.
Attachments
Issue Links
- is caused by
-
MDEV-20299 SET SESSION AUTHORIZATION
-
- In Testing
-