summaryrefslogtreecommitdiff
path: root/mysql-test/t/log_state.test
diff options
context:
space:
mode:
authorunknown <kaa@polly.(none)>2007-10-25 14:03:24 +0400
committerunknown <kaa@polly.(none)>2007-10-25 14:03:24 +0400
commit974201c7e041193428d83e8a90f67adc9d1fd201 (patch)
treec6a9bd2bf6abe12e4bce92168d57189e690dd5e0 /mysql-test/t/log_state.test
parente259d46103f743de343c78e4a88b13ebd274e05a (diff)
downloadmariadb-git-974201c7e041193428d83e8a90f67adc9d1fd201.tar.gz
Fix for bug #29131: SHOW VARIABLES reports variable 'log' but SET
doesn't recognize it This is a 5.1 version of the patch. Problem: 'log' and 'log_slow_queries' were "fixed" variables, i.e. they showed up in SHOW VARIABLES, but could not be used in expressions like "select @@log". Also, using them in the SET statement produced an incorrect "unknown system variable" error. Solution: Since as of MySQL 5.1.12 one can enable or disable the general query log or the slow query log at runtime by changing values of general_log/slow_query_log, make 'log' and 'log_slow_queries" to be synonyms for 'general_log' and 'slow_query_log' respectively. This makes expressions using the '@@var' syntax backward compatible with 5.0 and SHOW VARIABLES output to be consistent with the SET statement. mysql-test/r/log_state.result: Added a test case for bug #29131. mysql-test/t/log_state.test: Added a test case for bug #29131. sql/set_var.cc: Made the 'log' and 'log_slow_queries' system variables to be synonyms for 'general_log' and 'slow_query_log'.
Diffstat (limited to 'mysql-test/t/log_state.test')
-rw-r--r--mysql-test/t/log_state.test36
1 files changed, 36 insertions, 0 deletions
diff --git a/mysql-test/t/log_state.test b/mysql-test/t/log_state.test
index c67da261ef1..f7795e49b37 100644
--- a/mysql-test/t/log_state.test
+++ b/mysql-test/t/log_state.test
@@ -179,6 +179,42 @@ SET GLOBAL READ_ONLY = OFF;
SET GLOBAL general_log = @old_general_log_state;
SET GLOBAL slow_query_log = @old_slow_log_state;
+#
+# Bug #29131: SHOW VARIABLES reports variable 'log' but SET doesn't recognize it
+#
+
+SET @old_general_log_state = @@global.general_log;
+SET @old_slow_log_state = @@global.slow_query_log;
+
+SHOW VARIABLES LIKE 'general_log';
+SHOW VARIABLES LIKE 'log';
+SELECT @@general_log, @@log;
+SET GLOBAL log = 0;
+SHOW VARIABLES LIKE 'general_log';
+SHOW VARIABLES LIKE 'log';
+SELECT @@general_log, @@log;
+SET GLOBAL general_log = 1;
+SHOW VARIABLES LIKE 'general_log';
+SHOW VARIABLES LIKE 'log';
+SELECT @@general_log, @@log;
+
+SHOW VARIABLES LIKE 'slow_query_log';
+SHOW VARIABLES LIKE 'log_slow_queries';
+SELECT @@slow_query_log, @@log_slow_queries;
+SET GLOBAL log_slow_queries = 0;
+SHOW VARIABLES LIKE 'slow_query_log';
+SHOW VARIABLES LIKE 'log_slow_queries';
+SELECT @@slow_query_log, @@log_slow_queries;
+SET GLOBAL slow_query_log = 1;
+SHOW VARIABLES LIKE 'slow_query_log';
+SHOW VARIABLES LIKE 'log_slow_queries';
+SELECT @@slow_query_log, @@log_slow_queries;
+
+SET GLOBAL general_log = @old_general_log_state;
+SET GLOBAL slow_query_log = @old_slow_log_state;
+
+--echo End of 5.1 tests
+
--enable_ps_protocol
#