Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Duplicate
-
10.2.3, 10.3.0, 10.4.0, 10.4.12
-
None
Description
toddstoffel escalated a customer concern that ALTER USER IF EXISTS does not appear to function correctly, and inquired if this was a code defect or a documentation defect.
Local test confirmed that the documented ALTER USER IF EXISTS syntax generated an error.
Examination of the related KB content showed that the IF EXISTS content was present in the oldest version of the KB page.
Examination of sql_yacc.yy showed that the token order does not appear to align to the documented and expected behavior. Adjustment of the test query to the token order in sql_yacc.yy confirmed that the ALTER did not generate an error, confirming that this is a problem with the parser grammar. As implemented ALTER USER IF EXISTS is only accepted as ALTER IF EXISTS USER.
From 10.4.12:
/* ALTER USER foo is allowed for MySQL compatibility. */
|
| ALTER opt_if_exists USER_SYM clear_privileges grant_list
|
https://github.com/MariaDB/server/blob/mariadb-10.4.12/sql/sql_yacc.yy#L7972
This is inconsistent with how IF EXISTS is used by other commands. For example, it is DROP USER IF EXISTS, rather than DROP IF EXISTS USER:
| DROP USER_SYM opt_if_exists clear_privileges user_list
|
https://github.com/MariaDB/server/blob/mariadb-10.4.12/sql/sql_yacc.yy#L13338
The expected token order would be:
ALTER USER_SYM opt_if_exists ...
|
This defect appears present in 10.2, 10.3, 10.4.
Attachments
Issue Links
- duplicates
-
MDEV-17941 ALTER USER IF EXISTS does not work, although documentation says it should
- Closed