Bug #10077 Calling HOUR() with a high precision real number crashes thread
Submitted: 21 Apr 2005 22:28 Modified: 22 Apr 2005 0:11
Reporter: Dylan Weed Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Server Severity:S2 (Serious)
Version:4.1.11 OS:Linux (SuSe 9.2 on AMD 64)
Assigned to: CPU Architecture:Any

[21 Apr 2005 22:28] Dylan Weed
Description:
The HOUR() function returns a value when passed a single-precision real but crashes the thread when passed a double precision real.  I'm not sure what it means to call HOUR() on an integer rather than a time, but we discovered this when we made an inadvertent syntax error in a call to HOUR() in an outer query and this bug crashed the entire query rather than failing gracefully.

How to repeat:
QUERY 1:  WORKS

select hour(.15555) as test;
+------+
| test |
+------+
|    0 |
+------+

QUERY 2: CRASHES THE CONNECTION

select hour(.1555555555555555) as test;
ERROR 2013 (HY000): Lost connection to MySQL server during query
mysql>
Number of processes running now: 0
050421 15:30:25  mysqld restarted
[22 Apr 2005 0:11] Jorge del Conde
Was unable to reproduce w/4.1 & 5.0 from bk:

mysql> select hour(.1555555555555555) as test;
+------+
| test |
+------+
|    0 |
+------+
1 row in set, 1 warning (0.00 sec)

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