diff options
author | unknown <tnurnberg@salvation.intern.azundris.com> | 2006-08-10 15:37:24 +0200 |
---|---|---|
committer | unknown <tnurnberg@salvation.intern.azundris.com> | 2006-08-10 15:37:24 +0200 |
commit | fa1641e1f3c68e240d79099ae9a3a1346997e4d4 (patch) | |
tree | 50f526c96f9941c2dafbea672fcf826a762e03d1 /mysql-test/r/func_time.result | |
parent | d2aa274ac96c8fb98611c9bdd0469e3e8fb32a9f (diff) | |
download | mariadb-git-fa1641e1f3c68e240d79099ae9a3a1346997e4d4.tar.gz |
Bug#19844: time_format in Union truncates values
time_format() claimed %H and %k would return at most two digits
(hours 0-23), but this coincided neither with actual behaviour
nor with docs. this is not visible in simple queries; forcing
a temp-table is probably the easiest way to see this. adjusted
the return-length appropriately; the alternative would be to
adjust the docs to say that behaviour for > 99 hours is undefined.
---
Bug#19844: time_format in Union truncates values
time_format() claimed %H and %k would return at most two digits
(hours 0-23), but this coincided neither with actual behaviour
nor with docs. this is not visible in simple queries; forcing
a temp-table is probably the easiest way to see this. adjusted
the return-length appropriately; the alternative would be to
adjust the docs to say that behaviour for > 99 hours is undefined.
mysql-test/r/func_time.result:
Bug#19844: time_format in Union truncates values
show time_format() handles %H and %k correctly four > 99 hours
mysql-test/t/func_time.test:
Bug#19844: time_format in Union truncates values
show time_format() handles %H and %k correctly four > 99 hours
sql/item_timefunc.cc:
Bug#19844: time_format in Union truncates values
unbreak promises we make about field-length of %H and %k in
time_format() so they coincide with the actual range rather
than just 0..23. the docs say we must operate outside that
range, so we'd better do it right.
---
Bug#19844: time_format in Union truncates values
unbreak promises we make about field-length of %H and %k in
time_format() so they coincide with the actual range rather
than just 0..23. the docs say we must operate outside that
range, so we'd better do it right.
One digit values are padded to two digits with %H, "longer"
values are handled correctly up to seven digits including
any sign.
(clarified comments as per jimw's suggestion.)
Diffstat (limited to 'mysql-test/r/func_time.result')
-rw-r--r-- | mysql-test/r/func_time.result | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/mysql-test/r/func_time.result b/mysql-test/r/func_time.result index d8ba606a558..47a0f83802c 100644 --- a/mysql-test/r/func_time.result +++ b/mysql-test/r/func_time.result @@ -695,3 +695,24 @@ t1 CREATE TABLE `t1` ( `from_unixtime(1) + 0` double(23,6) default NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; +(select time_format(timediff(now(), DATE_SUB(now(),INTERVAL 5 DAY)),'%H') As H) +union +(select time_format(timediff(now(), DATE_SUB(now(),INTERVAL 5 DAY)),'%H') As H); +H +120 +(select time_format(timediff(now(), DATE_SUB(now(),INTERVAL 5 DAY)),'%k') As H) +union +(select time_format(timediff(now(), DATE_SUB(now(),INTERVAL 5 DAY)),'%k') As H); +H +120 +(select time_format(timediff(now(), DATE_SUB(now(),INTERVAL 5 HOUR)),'%H') As H) +union +(select time_format(timediff(now(), DATE_SUB(now(),INTERVAL 5 HOUR)),'%H') As H); +H +05 +(select time_format(timediff(now(), DATE_SUB(now(),INTERVAL 5 HOUR)),'%k') As H) +union +(select time_format(timediff(now(), DATE_SUB(now(),INTERVAL 5 HOUR)),'%k') As H); +H +5 +End of 4.1 tests |