From 6ba79a251681a765f491db1428a467a0a06a69bd Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 19 Nov 2005 01:22:12 +0300 Subject: [PATCH] Bug#13510 "Setting password local variable changes current password": additional fix, also make sure that a syntax error is returned for set names="foo" when there is no such variable or no stored procedure. mysql-test/r/sp-error.result: Test results fixed: a new test for Bug#13510 mysql-test/t/sp-error.test: A new test for Bug#13510 (set names out of an SP) sql/sql_yacc.yy: Bug#13510: fix the case when there is no stored procedure or no 'names' variable declared. Return a syntax error in this case. --- mysql-test/r/sp-error.result | 2 ++ mysql-test/t/sp-error.test | 4 ++++ sql/sql_yacc.yy | 3 +++ 3 files changed, 9 insertions(+) diff --git a/mysql-test/r/sp-error.result b/mysql-test/r/sp-error.result index 26bb0fa4694..858f7d0bb16 100644 --- a/mysql-test/r/sp-error.result +++ b/mysql-test/r/sp-error.result @@ -845,6 +845,8 @@ set password = 'foo1'; select password; end| ERROR 42000: Variable 'password' must be quoted with `...`, or renamed +set names='foo2'| +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 create procedure bug13510_2() begin declare names varchar(10); diff --git a/mysql-test/t/sp-error.test b/mysql-test/t/sp-error.test index 4cc141fea4b..5057dd0d9f8 100644 --- a/mysql-test/t/sp-error.test +++ b/mysql-test/t/sp-error.test @@ -1233,6 +1233,10 @@ begin select password; end| +# Check that an error message is sent +--error ER_PARSE_ERROR +set names='foo2'| + --error ER_SP_BAD_VAR_SHADOW create procedure bug13510_2() begin diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 339091ed4e8..2dc06642259 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -7925,6 +7925,9 @@ option_value: names.length= 5; if (spc && spc->find_pvar(&names)) my_error(ER_SP_BAD_VAR_SHADOW, MYF(0), names.str); + else + yyerror(ER(ER_SYNTAX_ERROR)); + YYABORT; } | NAMES_SYM charset_name_or_default opt_collate