diff options
-rw-r--r-- | mysql-test/r/parser.result | 25 | ||||
-rw-r--r-- | mysql-test/suite/sys_vars/r/general_log_file_basic.result | 1 | ||||
-rw-r--r-- | mysql-test/suite/sys_vars/r/slow_query_log_file_basic.result | 1 | ||||
-rw-r--r-- | mysql-test/suite/sys_vars/t/general_log_file_basic.test | 2 | ||||
-rw-r--r-- | mysql-test/suite/sys_vars/t/slow_query_log_file_basic.test | 2 | ||||
-rw-r--r-- | mysql-test/t/parser.test | 25 | ||||
-rw-r--r-- | sql/sql_yacc.yy | 9 |
7 files changed, 62 insertions, 3 deletions
diff --git a/mysql-test/r/parser.result b/mysql-test/r/parser.result index 1ea9e91df8a..a96773b8d81 100644 --- a/mysql-test/r/parser.result +++ b/mysql-test/r/parser.result @@ -622,3 +622,28 @@ DROP TABLE t1, t2, t3; # # End of 5.1 tests # +# +# Bug#17075846 : unquoted file names for variable values are +# accepted but parsed incorrectly +# +SET default_storage_engine=a.myisam; +ERROR 42000: Incorrect argument type to variable 'default_storage_engine' +SET default_storage_engine = .a.MyISAM; +ERROR 42000: Incorrect argument type to variable 'default_storage_engine' +SET default_storage_engine = a.b.MyISAM; +ERROR 42000: Incorrect argument type to variable 'default_storage_engine' +SET default_storage_engine = `a`.MyISAM; +ERROR 42000: Incorrect argument type to variable 'default_storage_engine' +SET default_storage_engine = `a`.`MyISAM`; +ERROR 42000: Incorrect argument type to variable 'default_storage_engine' +set default_storage_engine = "a.MYISAM"; +ERROR 42000: Unknown storage engine 'a.MYISAM' +set default_storage_engine = 'a.MYISAM'; +ERROR 42000: Unknown storage engine 'a.MYISAM' +set default_storage_engine = `a.MYISAM`; +ERROR 42000: Unknown storage engine 'a.MYISAM' +CREATE TABLE t1 (s VARCHAR(100)); +CREATE TRIGGER trigger1 BEFORE INSERT ON t1 FOR EACH ROW +SET default_storage_engine = NEW.INNODB; +ERROR 42S22: Unknown column 'INNODB' in 'NEW' +DROP TABLE t1; diff --git a/mysql-test/suite/sys_vars/r/general_log_file_basic.result b/mysql-test/suite/sys_vars/r/general_log_file_basic.result index 611e0f80d86..30bb0f35900 100644 --- a/mysql-test/suite/sys_vars/r/general_log_file_basic.result +++ b/mysql-test/suite/sys_vars/r/general_log_file_basic.result @@ -10,6 +10,7 @@ RIGHT(@@global.general_log_file, length(@a)) = @a 1 '#--------------------FN_DYNVARS_004_02------------------------#' SET @@global.general_log_file = mytest.log; +ERROR 42000: Incorrect argument type to variable 'general_log_file' SET @@global.general_log_file = 12; ERROR 42000: Incorrect argument type to variable 'general_log_file' '#----------------------FN_DYNVARS_004_03------------------------#' diff --git a/mysql-test/suite/sys_vars/r/slow_query_log_file_basic.result b/mysql-test/suite/sys_vars/r/slow_query_log_file_basic.result index e3c48725998..c032a36ce6a 100644 --- a/mysql-test/suite/sys_vars/r/slow_query_log_file_basic.result +++ b/mysql-test/suite/sys_vars/r/slow_query_log_file_basic.result @@ -7,6 +7,7 @@ RIGHT(@@global.slow_query_log_file, length(@a)) = @a 1 '#--------------------FN_DYNVARS_004_02------------------------#' SET @@global.slow_query_log_file = mytest.log; +ERROR 42000: Incorrect argument type to variable 'slow_query_log_file' SET @@global.slow_query_log_file = 12; ERROR 42000: Incorrect argument type to variable 'slow_query_log_file' '#----------------------FN_DYNVARS_004_03------------------------#' diff --git a/mysql-test/suite/sys_vars/t/general_log_file_basic.test b/mysql-test/suite/sys_vars/t/general_log_file_basic.test index 43d7414a0c2..c1be3f53d4f 100644 --- a/mysql-test/suite/sys_vars/t/general_log_file_basic.test +++ b/mysql-test/suite/sys_vars/t/general_log_file_basic.test @@ -54,7 +54,7 @@ SELECT RIGHT(@@global.general_log_file, length(@a)) = @a; # Change the value of general_log_file to a invalid value # ####################################################################### -# Assumed text if no quotes or numbers. +--error ER_WRONG_TYPE_FOR_VAR SET @@global.general_log_file = mytest.log; --error ER_WRONG_TYPE_FOR_VAR SET @@global.general_log_file = 12; diff --git a/mysql-test/suite/sys_vars/t/slow_query_log_file_basic.test b/mysql-test/suite/sys_vars/t/slow_query_log_file_basic.test index bac0d0c8198..8e68ed41baa 100644 --- a/mysql-test/suite/sys_vars/t/slow_query_log_file_basic.test +++ b/mysql-test/suite/sys_vars/t/slow_query_log_file_basic.test @@ -52,7 +52,7 @@ SELECT RIGHT(@@global.slow_query_log_file, length(@a)) = @a; # Change the value of slow_query_log_file to a invalid value # ####################################################################### -# Assumed text if no quotes or numbers. +--error ER_WRONG_TYPE_FOR_VAR SET @@global.slow_query_log_file = mytest.log; --error ER_WRONG_TYPE_FOR_VAR SET @@global.slow_query_log_file = 12; diff --git a/mysql-test/t/parser.test b/mysql-test/t/parser.test index d477843b22b..6899e2876a6 100644 --- a/mysql-test/t/parser.test +++ b/mysql-test/t/parser.test @@ -733,3 +733,28 @@ DROP TABLE t1, t2, t3; --echo # End of 5.1 tests --echo # +--echo # +--echo # Bug#17075846 : unquoted file names for variable values are +--echo # accepted but parsed incorrectly +--echo # +--error ER_WRONG_TYPE_FOR_VAR +SET default_storage_engine=a.myisam; +--error ER_WRONG_TYPE_FOR_VAR +SET default_storage_engine = .a.MyISAM; +--error ER_WRONG_TYPE_FOR_VAR +SET default_storage_engine = a.b.MyISAM; +--error ER_WRONG_TYPE_FOR_VAR +SET default_storage_engine = `a`.MyISAM; +--error ER_WRONG_TYPE_FOR_VAR +SET default_storage_engine = `a`.`MyISAM`; +--error ER_UNKNOWN_STORAGE_ENGINE +set default_storage_engine = "a.MYISAM"; +--error ER_UNKNOWN_STORAGE_ENGINE +set default_storage_engine = 'a.MYISAM'; +--error ER_UNKNOWN_STORAGE_ENGINE +set default_storage_engine = `a.MYISAM`; +CREATE TABLE t1 (s VARCHAR(100)); +--ERROR ER_BAD_FIELD_ERROR +CREATE TRIGGER trigger1 BEFORE INSERT ON t1 FOR EACH ROW +SET default_storage_engine = NEW.INNODB; +DROP TABLE t1; diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 13c547cb9f7..3af964db731 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -1,5 +1,5 @@ /* - Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -444,6 +444,13 @@ set_system_variable(THD *thd, struct sys_var_with_base *tmp, if (lex->spcont && tmp->var == Sys_autocommit_ptr) lex->sphead->m_flags|= sp_head::HAS_SET_AUTOCOMMIT_STMT; + if (val && val->type() == Item::FIELD_ITEM && + ((Item_field*)val)->table_name) + { + my_error(ER_WRONG_TYPE_FOR_VAR, MYF(0), tmp->var->name.str); + return TRUE; + } + if (! (var= new set_var(var_type, tmp->var, &tmp->base_name, val))) return TRUE; |