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

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.039 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.