summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mysql-test/r/variables.result9
-rw-r--r--mysql-test/t/variables.test8
-rw-r--r--sql/sql_show.cc2
3 files changed, 18 insertions, 1 deletions
diff --git a/mysql-test/r/variables.result b/mysql-test/r/variables.result
index 28b67732a77..90365669229 100644
--- a/mysql-test/r/variables.result
+++ b/mysql-test/r/variables.result
@@ -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
diff --git a/mysql-test/t/variables.test b/mysql-test/t/variables.test
index b1288b6e24d..28f4344bd38 100644
--- a/mysql-test/t/variables.test
+++ b/mysql-test/t/variables.test
@@ -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
diff --git a/sql/sql_show.cc b/sql/sql_show.cc
index afbda8dd0b1..c18cc78e33e 100644
--- a/sql/sql_show.cc
+++ b/sql/sql_show.cc
@@ -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;