Commit 6389fd3c authored by Sergei Golubchik's avatar Sergei Golubchik

MDEV-6673 I_S.SESSION_VARIABLES shows global values

only look at lex->option_type if it's a SHOW command, not a SELECT
parent c01c8192
......@@ -1804,4 +1804,13 @@ set session rand_seed1=DEFAULT;
ERROR 42000: Variable 'rand_seed1' doesn't have a default value
set autocommit = values(v);
ERROR 42S22: Unknown column 'v' in 'field list'
set session sql_mode=ansi_quotes;
select * from information_schema.session_variables where variable_name='sql_mode';
VARIABLE_NAME VARIABLE_VALUE
SQL_MODE ANSI_QUOTES
show global status like 'foobar';
Variable_name Value
select * from information_schema.session_variables where variable_name='sql_mode';
VARIABLE_NAME VARIABLE_VALUE
SQL_MODE ANSI_QUOTES
End of 5.5 tests
......@@ -1553,4 +1553,12 @@ set session rand_seed1=DEFAULT;
--error ER_BAD_FIELD_ERROR
set autocommit = values(v);
#
# MDEV-6673 I_S.SESSION_VARIABLES shows global values
#
set session sql_mode=ansi_quotes;
select * from information_schema.session_variables where variable_name='sql_mode';
show global status like 'foobar';
select * from information_schema.session_variables where variable_name='sql_mode';
--echo End of 5.5 tests
......@@ -6934,7 +6934,7 @@ int fill_variables(THD *thd, TABLE_LIST *tables, COND *cond)
bool upper_case_names= (schema_table_idx != SCH_VARIABLES);
bool sorted_vars= (schema_table_idx == SCH_VARIABLES);
if (lex->option_type == OPT_GLOBAL ||
if ((sorted_vars && lex->option_type == OPT_GLOBAL) ||
schema_table_idx == SCH_GLOBAL_VARIABLES)
option_type= OPT_GLOBAL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment