[MDEV-21685] ALTER USER parser definition has wrong parameter order Created: 2020-02-07  Updated: 2020-02-10  Resolved: 2020-02-10

Status: Closed
Project: MariaDB Server
Component/s: Authentication and Privilege System
Affects Version/s: 10.2.3, 10.3.0, 10.4.0, 10.4.12
Fix Version/s: N/A

Type: Bug Priority: Major
Reporter: Jacob Moorman (Inactive) Assignee: Unassigned
Resolution: Duplicate Votes: 0
Labels: None

Issue Links:
Duplicate
duplicates MDEV-17941 ALTER USER IF EXISTS does not work, a... Closed

 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.


Generated at Thu Feb 08 09:09:01 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.