summaryrefslogtreecommitdiff
path: root/mysql-test/r/func_sapdb.result
diff options
context:
space:
mode:
authorTatiana A. Nurnberg <azundris@mysql.com>2008-11-26 09:28:17 +0100
committerTatiana A. Nurnberg <azundris@mysql.com>2008-11-26 09:28:17 +0100
commitd096079d330f77eebd3c3abef04236a9a4a08d7b (patch)
tree89fc8f73a3e600368596aa2d7d21302f2ee7f34b /mysql-test/r/func_sapdb.result
parentdf8a5474f8a904b4e254e446fd6ea61a94c98e2a (diff)
downloadmariadb-git-d096079d330f77eebd3c3abef04236a9a4a08d7b.tar.gz
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)<TIME(0) type that rendered a negative result, but still gave false in comparison. We also inadvertantly dropped the sign when converting times to decimal. CAST(time AS DECIMAL) handles signs of the times correctly. TIMEDIFF() marked up as signed. Time/date comparison code switched to signed for clarity. mysql-test/r/func_sapdb.result: show that time-related comparisons work with negative time values now. show that converting time to DECIMAL no longer drops sign. mysql-test/t/func_sapdb.test: show that time-related comparisons work with negative time values now. show that converting time to DECIMAL no longer drops sign. sql/item_cmpfunc.cc: signed returns sql/item_cmpfunc.h: signed now (time/date < > =) 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
Diffstat (limited to 'mysql-test/r/func_sapdb.result')
-rw-r--r--mysql-test/r/func_sapdb.result12
1 files changed, 12 insertions, 0 deletions
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');
+timediff('2008-09-29 20:10:10','2008-09-30 20:10:10')<time('00:00:00')
+1
+SELECT CAST(time('-73:42:12') AS DECIMAL);
+CAST(time('-73:42:12') AS DECIMAL)
+-734212