Bug #34831 Enumeration and some of the boolean variables can be assigned decimal values
Submitted: 26 Feb 2008 12:25 Modified: 27 Feb 2008 19:36
Reporter: Rizwan Maredia Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Errors Severity:S3 (Non-critical)
Version:5.1.22, 4.1, 5.0, 5.1, 6.0 BK OS:Any
Assigned to: CPU Architecture:Any
Tags: boolean, decimal values, Enumeration
Triage: Triaged: D3 (Medium)

[26 Feb 2008 12:25] Rizwan Maredia
Description:
When a Decimal value is set to a variable of type enumeration (or even boolean some times) its value is rounded and then if the value is within range it is assigned to the variable.
 
Some of the variables with such behavior are

myisam_stats_method
query_cache_type
tx_isolation
sql_mode
sql_buffer_result

How to repeat:
The following code snippet is tested against mysql test environment.

SET @@session.sql_buffer_result = 1.4;
SELECT @@session.sql_buffer_result;

Output:
SET @@session.sql_buffer_result = 1.4;
SELECT @@session.sql_buffer_result;
@@session.sql_buffer_result
1

Suggested fix:
Server should give error when decimal value is assigned to it.