Bug #24691 very big TIMEDIFF results (> 880h) returned from a function render 838:59:59
Submitted: 29 Nov 2006 12:59 Modified: 29 Nov 2006 13:16
Reporter: Costin Bereveanu Email Updates:
Status: Duplicate Impact on me:
Category:MySQL Server Severity:S2 (Serious)
Version:5.0.27 OS:Microsoft Windows (Windows XP Pro)
Assigned to: CPU Architecture:Any
Tags: 838, 838:59:59, FUNCTION, return, timediff

[29 Nov 2006 12:59] Costin Bereveanu
See issue #11655 for a related problem.
This is what I've posted as a comment there - haven't noticed it was closed:

I have a function that should have returned a TIME value. The return statement
actually consists in a TIMEDIFF call. Although the result is big enough (888
hours and something), the value returned by the function is 838:59:59. Reading
the above comments, I've managed to fix the problem by returning the number of
seconds instead (TIME_TO_SEC(TIMEDIFF())) and then SEC_TO_TIME(function_call) in
my select.
This is not very ok though...
The issue also replicates for variables in a function. I tried assigning the
TIMEDIFF result to a TIME variable and return that. Same error.

How to repeat:


CREATE DEFINER=`root`@`localhost` FUNCTION test_bug() RETURNS TIME
RETURN TIMEDIFF('2006-11-29 10:23:45', '2006-08-31 11:45:33');

[29 Nov 2006 13:16] Valeriy Kravchuk
Please do not submit the same bug more than once. It is a duplicate of bug #11655. fixed in 5.0.30. So, surely, 5.0.27 still has this problem.