Bug #25848 Different errors on the same invalid GRANT statement

Submitted: 25 Jan 2007 14:16 Modified: 1 Feb 2007 18:25
Reporter: Alexey Kopytov Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server: Errors Severity:S4 (Feature request)
Version:4.0.28, 4.1.23, 5.0.36, 5.1.15 OS:
Assigned to: CPU Architecture:Any

[25 Jan 2007 14:16] Alexey Kopytov
Description:
The following GRANT statement:

GRANT PROCESS ON * TO user@localhost;

which has an invalid syntax according to the manual returns different error messages. When there is no default database the error returned is "ERROR 1046 (3D000): No database selected". When there is a default database, the error is "ERROR 1221 (HY000): Incorrect usage of DB GRANT and GLOBAL PRIVILEGES" (a correct one).

How to repeat:
shell> mysql -u root

mysql> GRANT PROCESS ON * TO user@localhost;
ERROR 1046 (3D000): No database selected

mysql> GRANT PROCESS ON * TO user@localhost;
ERROR 1221 (HY000): Incorrect usage of DB GRANT and GLOBAL PRIVILEGES
[25 Jan 2007 14:18] Alexey Kopytov
The "How to repeat" section should actually be:

shell> mysql -u root

mysql> GRANT PROCESS ON * TO user@localhost;
ERROR 1046 (3D000): No database selected

mysql> use test;

mysql> GRANT PROCESS ON * TO user@localhost;
ERROR 1221 (HY000): Incorrect usage of DB GRANT and GLOBAL PRIVILEGES
[1 Feb 2007 18:25] Sergei Golubchik
It's not incorrect. Compare with:

shell> mysql -u root

mysql> grant select on * to user@localhost;
ERROR 1046 (3D000): No database selected

That is, there're two errors in your statement, the first that is found it returned.

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.039 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.