Bug #20441 timestamp operation returns unexpected value
Submitted: 13 Jun 2006 21:04 Modified: 13 Jun 2006 22:18
Reporter: Jerry Zheng Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:4.1.18 OS:Linux (Linux AMD 64)
Assigned to: CPU Architecture:Any

[13 Jun 2006 21:04] Jerry Zheng
Description:
Expecting the two operations MIN(TSTAMP)+0 and MIN(TSTAMP+0) return the same value but the results are different.

mysql> select  MIN(TSTAMP), MIN(TSTAMP)+0, MIN(TSTAMP+0)  from local.tab;
+---------------------+---------------+----------------+
| MIN(TSTAMP)         | MIN(TSTAMP)+0 | MIN(TSTAMP+0)  |
+---------------------+---------------+----------------+
| 2005-10-11 17:50:21 |          2005 | 20051011175021 |
+---------------------+---------------+----------------+
1 row in set (0.00 sec)

The MIN(TSTAMP)+0 result is unexpected.

How to repeat:
see above
[13 Jun 2006 22:18] Hartmut Holzgraefe
MIN() interpretes "2005-10-11 17:50:21" as a string, +0 casts it back to an integer first before adding the zero, and so only the leading digits are significant