From d096079d330f77eebd3c3abef04236a9a4a08d7b Mon Sep 17 00:00:00 2001 From: "Tatiana A. Nurnberg" Date: Wed, 26 Nov 2008 09:28:17 +0100 Subject: Bug#37553: MySql Error Compare TimeDiff & Time We pretended that TIMEDIFF() would always return positive results; this gave strange results in comparisons of the TIMEDIFF(low,hi) =) sql/item_func.cc: signed now sql/item_timefunc.h: Functions such as TIMEDIFF() return signed results! The file-comments pretended we were doing that all along, anyway... sql/my_decimal.cc: heed sign when converting time to my_decimal; times may actually be negative! Needed for SELECT CAST(time('-73:42:12') AS DECIMAL); sql/mysql_priv.h: using signed for dates and times now --- mysql-test/r/func_sapdb.result | 12 ++++++++++++ mysql-test/t/func_sapdb.test | 17 +++++++++++++++++ 2 files changed, 29 insertions(+) (limited to 'mysql-test') diff --git a/mysql-test/r/func_sapdb.result b/mysql-test/r/func_sapdb.result index 4db0416bdce..a06d7004908 100644 --- a/mysql-test/r/func_sapdb.result +++ b/mysql-test/r/func_sapdb.result @@ -256,3 +256,15 @@ a select str_to_date("2003-01-02 10:11:12.0012", "%Y-%m-%d %H:%i:%S.%f"); str_to_date("2003-01-02 10:11:12.0012", "%Y-%m-%d %H:%i:%S.%f") 2003-01-02 10:11:12.001200 +select timediff('2008-09-29 20:10:10','2008-09-30 20:10:10'),time('00:00:00'); +timediff('2008-09-29 20:10:10','2008-09-30 20:10:10') time('00:00:00') +-24:00:00 00:00:00 +select timediff('2008-09-29 20:10:10','2008-09-30 20:10:10')>time('00:00:00'); +timediff('2008-09-29 20:10:10','2008-09-30 20:10:10')>time('00:00:00') +0 +select timediff('2008-09-29 20:10:10','2008-09-30 20:10:10')time('00:00:00'); +select timediff('2008-09-29 20:10:10','2008-09-30 20:10:10')