Bug #43437 Unexpected warning 1292 "Truncated incorrect INTEGER value..." with CASE WHEN
Submitted: 6 Mar 2009 1:45 Modified: 6 Mar 2009 6:51
Reporter: Yoshiaki Tajika (Basic Quality Contributor) Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.0.74, 5.0, 5.1, 6.0/5.6 bzr OS:Linux
Assigned to: CPU Architecture:Any

[6 Mar 2009 1:45] Yoshiaki Tajika
Description:
I get an unexpected warning 1292 "Truncated incorrect INTEGER value...".
I tried at 5.0.74(on linux) and 5.1.30(on windows), but got the warning
in both cases. 

How to repeat:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.0.74-debug-log Source distribution

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> use test;
Database changed

mysql> create table t1(c1 varchar(8), c2 char(8)) engine=myisam default charset=latin1;
Query OK, 0 rows affected (0.03 sec)

mysql> insert t1 values('vvvv','cccc');
Query OK, 1 row affected (0.00 sec)

mysql> select count(CASE WHEN 1=1 THEN c1 ELSE null END) from t1;
+--------------------------------------------+
| count(CASE WHEN 1=1 THEN c1 ELSE null END) |
+--------------------------------------------+
|                                          1 | 
+--------------------------------------------+
1 row in set (0.03 sec)
/* ==> no warnings for varchar column */

mysql> select count(CASE WHEN 1=1 THEN c2 ELSE null END) from t1;
+--------------------------------------------+
| count(CASE WHEN 1=1 THEN c2 ELSE null END) |
+--------------------------------------------+
|                                          1 | 
+--------------------------------------------+
1 row in set, 1 warning (0.00 sec)

mysql> show warnings;
+---------+------+-----------------------------------------------+
| Level   | Code | Message                                       |
+---------+------+-----------------------------------------------+
| Warning | 1292 | Truncated incorrect INTEGER value: 'cccc    ' | 
+---------+------+-----------------------------------------------+
1 row in set (0.00 sec)

mysql> exit

Suggested fix:
No idea.
[6 Mar 2009 6:51] Sveta Smirnova
Thank you for the report.

Verified as described.

Version 4.1 is not affected.

In version 6.0 both queries produce warning.
[17 Mar 2015 18:18] MySQL Verification Team
http://bugs.mysql.com/bug.php?id=76353 marked as duplicate of this one.