Bug #80364 CASE WHEN timestamp with microseconds are not working as expected
Submitted: 15 Feb 2016 10:03 Modified: 11 Dec 2019 21:59
Reporter: Su Dylan Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: DML Severity:S3 (Non-critical)
Version:5.7.8, 5.6.29, 5.7.11 OS:Any
Assigned to: CPU Architecture:Any

[15 Feb 2016 10:03] Su Dylan
Description:
Output:
=====
mysql> SELECT CASE timestamp '2012-01-01 01:01:01.000000' WHEN '2011-01-01 01:01:01' THEN 2011  WHEN '2012-01-01 01:01:01' THEN 2012 ELSE 9999 END;
+--------------------------------------------------------------------------------------------------------------------------------------+
| CASE timestamp '2012-01-01 01:01:01.000000' WHEN '2011-01-01 01:01:01' THEN 2011  WHEN '2012-01-01 01:01:01' THEN 2012 ELSE 9999 END |
+--------------------------------------------------------------------------------------------------------------------------------------+
|                                                                                                                                 9999 |
+--------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)

mysql> select version();
+-----------+
| version() |
+-----------+
| 5.7.8-rc  |
+-----------+
1 row in set (0.00 sec)

Problem:
=====
2012 is expected.

How to repeat:
SELECT CASE timestamp '2012-01-01 01:01:01.000000' WHEN '2011-01-01 01:01:01' THEN 2011  WHEN '2012-01-01 01:01:01' THEN 2012 ELSE 9999 END;

Suggested fix:
2012 is returned.
[15 Feb 2016 11:31] MySQL Verification Team
Hello Su Dylan,

Thank you for the report.
Observed this with 5.6.29, 5.7.11 builds.

Thanks,
Umesh
[11 Dec 2019 21:59] Roy Lyseng
Posted by developer:
 
Fixed in 5.7.29