Bug #29131 SHOW VARIABLES reports variable 'log' but SET doesn't recognize it
Submitted: 15 Jun 2007 8:14 Modified: 26 Nov 2007 18:39
Reporter: Andrey Hristov Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Logging Severity:S3 (Non-critical)
Version:4.1, 5.0, 5.1 OS:Any
Assigned to: Alexey Kopytov CPU Architecture:Any

[15 Jun 2007 8:14] Andrey Hristov
Description:
SHOW VARIABLES shows 'log' variable but SET doesn't find it, because it's actually named general_log .

How to repeat:
mysql> show variables like 'log';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| log           | OFF   |
+---------------+-------+
1 row in set (0.00 sec)

mysql> set global log=on;
ERROR 1193 (HY000): Unknown system variable 'log'
mysql> set global general_log=on;
Query OK, 0 rows affected (0.00 sec)
[15 Jun 2007 8:53] Sveta Smirnova
Thank you for the report.

Verified as described.
[15 Jun 2007 10:11] Andrey Hristov
Well, a problem is also that there is no general_log variable shown in SHOW VARIABLES. Actually general_log is shown as 'log'. 'log' is not read-only, as it is actually 'general_log'.
[15 Jun 2007 10:11] Andrey Hristov
It's not read-only for 5.1
[25 Oct 2007 10:02] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/36328

ChangeSet@1.2547, 2007-10-25 14:02:27+04:00, kaa@polly.(none) +6 -0
  Fix for bug #29131: SHOW VARIABLES reports variable 'log' but SET
  doesn't recognize it
  
  This is a 5.0 version of the patch, it will be null-merged to 5.1
  
  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:
  
  Make 'log' and 'log_slow_queries' read-only dynamic variables to make 
  them available for use in expressions, and produce a correct error 
  about the variable being read-only when used in the SET statement.
[25 Oct 2007 10:03] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/36329

ChangeSet@1.2588, 2007-10-25 14:03:24+04:00, kaa@polly.(none) +3 -0
  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.
[25 Oct 2007 10:09] Sergey Glukhov
ok to push
[29 Oct 2007 8:53] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/36525

ChangeSet@1.2553, 2007-10-29 11:52:44+03:00, kaa@polly.(none) +1 -0
  Fixed compile warnings introduced by the patch for bug #29131.
[16 Nov 2007 9:31] Bugs System
Pushed into 5.0.52
[16 Nov 2007 9:32] Bugs System
Pushed into 5.1.23-rc
[16 Nov 2007 9:34] Bugs System
Pushed into 6.0.4-alpha
[26 Nov 2007 18:39] Paul Dubois
Noted in 5.0.52 changelog.

The log and log_slow_queries system variables were displayed by SHOW
VARIABLES but could not be accessed in expressions as @@log and
@@log_slow_queries. Also, attempting to set them with SET produced an
incorrect Unknown system variable message. Now these variables can be
accessed in expressions and attempting to set their values produces 
an error message that the variable is read only.

Noted in 5.1.23, 6.0.4 changelogs.

The log and log_slow_queries system variables were displayed by SHOW
VARIABLES but could not be accessed in expressions as @@log and 
@@log_slow_queries. Also, attempting to set them with SET produced an
incorrect Unknown system variable message. Now these variables are
treated as synonyms for general_log and slow_query_log, which means
that they can be accessed in expressions and their values can be
changed with SET.