Bug #34839 Values in variable and information_schema do not match for autocommit
Submitted: 26 Feb 2008 13:12 Modified: 26 Feb 2008 13:45
Reporter: Salman Rawala Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server: Information schema Severity:S3 (Non-critical)
Version:5.1.22 OS:Any
Assigned to: CPU Architecture:Any
Tags: autocommit, information schema

[26 Feb 2008 13:12] Salman Rawala
Description:
When we compare value of variable with the value from the information schema, it returns false in output which shows that the value of variable and its value in information schema does not match. 

How to repeat:
You can reproduce this bug by using following statement

SELECT @@autocommit = VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME='autocommit';

Output:
SELECT @@autocommit = VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME='autocommit';
@@autocommit = VARIABLE_VALUE
0

Actual Result is 0 because the value in variable is 1 and the value in information schema is ON

Suggested fix:
Expected Result is 1 because the value in variable and information schema should match either 0,1 should be used or ON,OFF should be used.
[26 Feb 2008 13:45] Peter Gulutzan
@@autocommit is an integer, information_schema.variable_value
is a varchar. They have corresponding information, but are
not the same data type, and assigning the string 'ON' or 'OFF'
to an integer target will result in 0.