mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
Fixed BUG#13510: Setting password local variable changes current password
Disallow conflicting use of variables named "password" and "names". If such a variable is declared, and "SET ... = ..." is used for them, an error is returned; the user must resolve the conflict by either using `var` (indicating that the local variable is set) or by renaming the variable. This is necessary since setting "password" and "names" are treated as special cases by the parser. mysql-test/r/sp-error.result: New test cases for BUG#13510 mysql-test/t/sp-error.test: New test cases for BUG#13510 sql/share/errmsg.txt: New error message for when certain variable names are use which would be parsed the wrong way. (E.g. "password" and "names") sql/sql_yacc.yy: Check if "names" or "password" are used as local variable/parameter, in which case "set names" or "set password" will be parsed the wrong way. Give an error message instead.
This commit is contained in:
@ -1212,6 +1212,59 @@ call bug9367();
|
||||
drop procedure bug9367;
|
||||
drop table t1;
|
||||
--enable_parsing
|
||||
|
||||
#
|
||||
# BUG#13510: Setting password local variable changes current password
|
||||
#
|
||||
delimiter |;
|
||||
--disable_warnings
|
||||
drop procedure if exists bug13510_1|
|
||||
drop procedure if exists bug13510_2|
|
||||
drop procedure if exists bug13510_3|
|
||||
drop procedure if exists bug13510_4|
|
||||
--enable_warnings
|
||||
|
||||
--error ER_SP_BAD_VAR_SHADOW
|
||||
create procedure bug13510_1()
|
||||
begin
|
||||
declare password varchar(10);
|
||||
|
||||
set password = 'foo1';
|
||||
select password;
|
||||
end|
|
||||
|
||||
--error ER_SP_BAD_VAR_SHADOW
|
||||
create procedure bug13510_2()
|
||||
begin
|
||||
declare names varchar(10);
|
||||
|
||||
set names = 'foo2';
|
||||
select names;
|
||||
end|
|
||||
|
||||
create procedure bug13510_3()
|
||||
begin
|
||||
declare password varchar(10);
|
||||
|
||||
set `password` = 'foo3';
|
||||
select password;
|
||||
end|
|
||||
|
||||
create procedure bug13510_4()
|
||||
begin
|
||||
declare names varchar(10);
|
||||
|
||||
set `names` = 'foo4';
|
||||
select names;
|
||||
end|
|
||||
|
||||
call bug13510_3()|
|
||||
call bug13510_4()|
|
||||
|
||||
drop procedure bug13510_3|
|
||||
drop procedure bug13510_4|
|
||||
delimiter ;|
|
||||
|
||||
#
|
||||
# BUG#NNNN: New bug synopsis
|
||||
#
|
||||
|
Reference in New Issue
Block a user