Skip to content

Commit f6663bf

Browse files
author
Alexey Botchkov
committed
MDEV-17941 ALTER USER IF EXISTS does not work, although documentation says it should.
Mistake in syntax definition fixed - should be ALTER USER IF EXISTS, not ALTER IF EXISTS USER.
1 parent 235d7c6 commit f6663bf

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

mysql-test/r/alter_user.result

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ SET GLOBAL read_only = @start_read_only;
4343
alter user boo;
4444
ERROR HY000: Operation ALTER USER failed for 'boo'
4545
#--warning ER_CANNOT_USER
46-
alter if exists user boo;
46+
alter user if exists boo;
4747
Warnings:
4848
Error 1133 Can't find any matching row in the user table
4949
Note 1396 Operation ALTER USER failed for 'boo'

mysql-test/t/alter_user.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ SET GLOBAL read_only = @start_read_only;
4141
--error ER_CANNOT_USER
4242
alter user boo;
4343
--echo #--warning ER_CANNOT_USER
44-
alter if exists user boo;
44+
alter user if exists boo;
4545

4646
--echo # Test password related altering.
4747
alter user foo identified by 'something';

sql/sql_yacc.yy

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7294,10 +7294,10 @@ alter:
72947294
lex->server_options.reset($3);
72957295
} OPTIONS_SYM '(' server_options_list ')' { }
72967296
/* ALTER USER foo is allowed for MySQL compatibility. */
7297-
| ALTER opt_if_exists USER_SYM clear_privileges grant_list
7297+
| ALTER USER_SYM opt_if_exists clear_privileges grant_list
72987298
opt_require_clause opt_resource_options
72997299
{
7300-
Lex->create_info.set($2);
7300+
Lex->create_info.set($3);
73017301
Lex->sql_command= SQLCOM_ALTER_USER;
73027302
}
73037303
;

0 commit comments

Comments
 (0)