Cleanup in the system variable parsing code

- Adding "return true" into LEX::set_system_variable()
  and LEX::set_default_system_variable() after my_error().
  This makes the parser exit on error immediately.
  Previously, the error was caught only in mysql_parser(),
  a few lines after the parse_sql() call.
- Fixing "--error 1272" to "--error ER_VARIABLE_IS_NOT_STRUCT" in tests
This commit is contained in:
Alexander Barkov 2018-04-03 20:06:57 +04:00
parent 94ecd2314d
commit b7ea563491
2 changed files with 7 additions and 1 deletions

View file

@ -44,7 +44,7 @@ SET @@global.key_buffer_size=@save_key_buffer_size;
--error 1064
SELECT @@default.key_buffer_size;
--error 1272
--error ER_VARIABLE_IS_NOT_STRUCT
SELECT @@skr.storage_engine="test";
select @@keycache1.key_cache_block_size;

View file

@ -7011,7 +7011,10 @@ bool LEX::set_default_system_variable(enum_var_type var_type,
if (!var)
return true;
if (!var->is_struct())
{
my_error(ER_VARIABLE_IS_NOT_STRUCT, MYF(0), name->str);
return true;
}
return set_system_variable(var_type, var, &default_base_name, val);
}
@ -7040,7 +7043,10 @@ bool LEX::set_system_variable(THD *thd, enum_var_type var_type,
return true;
}
if (!tmp->is_struct())
{
my_error(ER_VARIABLE_IS_NOT_STRUCT, MYF(0), name2->str);
return true;
}
return set_system_variable(var_type, tmp, name1, val);
}