Skip to content
Permalink
Browse files
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
  • Loading branch information
abarkov committed Apr 3, 2018
1 parent 94ecd23 commit b7ea563
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
@@ -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;
@@ -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);
}

0 comments on commit b7ea563

Please sign in to comment.