Below is the list of changes that have just been committed into a local
4.1 repository of tnurnberg. When tnurnberg does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet@stripped, 2006-08-07 13:02:28+02:00, tnurnberg@stripped +3 -0
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@stripped, 2006-08-07 13:02:18+02:00,
tnurnberg@stripped +6 -0
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@stripped, 2006-08-07 13:02:18+02:00,
tnurnberg@stripped +9 -1
Bug#19844: time_format in Union truncates values
show time_format() handles %H and %k correctly four > 99 hours
sql/item_timefunc.cc@stripped, 2006-08-07 13:02:19+02:00,
tnurnberg@stripped +4 -2
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.
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: tnurnberg
# Host: salvation.intern.azundris.com
# Root: /home/tnurnberg/work/mysql-4.1-maint-19844
--- 1.105/sql/item_timefunc.cc 2006-08-07 13:02:40 +02:00
+++ 1.106/sql/item_timefunc.cc 2006-08-07 13:02:40 +02:00
@@ -1600,14 +1600,12 @@ uint Item_func_date_format::format_lengt
case 'u': /* week (00..52), where week starts with Monday */
case 'V': /* week 1..53 used with 'x' */
case 'v': /* week 1..53 used with 'x', where week starts with Monday */
- case 'H': /* hour (00..23) */
case 'y': /* year, numeric, 2 digits */
case 'm': /* month, numeric */
case 'd': /* day (of the month), numeric */
case 'h': /* hour (01..12) */
case 'I': /* --||-- */
case 'i': /* minutes, numeric */
- case 'k': /* hour ( 0..23) */
case 'l': /* hour ( 1..12) */
case 'p': /* locale's AM or PM */
case 'S': /* second (00..61) */
@@ -1615,6 +1613,10 @@ uint Item_func_date_format::format_lengt
case 'c': /* month (0..12) */
case 'e': /* day (0..31) */
size += 2;
+ break;
+ case 'k': /* hour ( 0..23) */
+ case 'H': /* hour (00..23) */
+ size += 7; /* docs guarantee success for > 23, cover full range */
break;
case 'r': /* time, 12-hour (hh:mm:ss [AP]M) */
size += 11;
--- 1.40/mysql-test/r/func_time.result 2006-08-07 13:02:40 +02:00
+++ 1.41/mysql-test/r/func_time.result 2006-08-07 13:02:40 +02:00
@@ -695,3 +695,9 @@ 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
+End of 4.1 tests
--- 1.35/mysql-test/t/func_time.test 2006-08-07 13:02:40 +02:00
+++ 1.36/mysql-test/t/func_time.test 2006-08-07 13:02:40 +02:00
@@ -368,4 +368,12 @@ create table t1 select now() - now(), cu
show create table t1;
drop table t1;
-# End of 4.1 tests
+#
+# Bug #19844 time_format in Union truncates values
+#
+
+(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);
+
+--echo End of 4.1 tests
| Thread |
|---|
| • bk commit into 4.1 tree (tnurnberg:1.2537) BUG#19844 | Tatjana A Nuernberg | 7 Aug |