From: Date: October 17 2006 1:30pm Subject: bk commit into 5.0 tree (ramil:1.2302) BUG#22229 List-Archive: http://lists.mysql.com/commits/13798 X-Bug: 22229 Message-Id: <200610171130.k9HBUuSO041022@myoffice.izhnet.ru> Below is the list of changes that have just been committed into a local 5.0 repository of ram. When ram 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-10-17 16:30:49+05:00, ramil@stripped +3 -0 Fix for bug #22229: Bug in DATE_ADD() From the manual: date arithmetic operations require complete dates and do not work with incomplete dates such as '2006-07-00' or badly malformed dates. mysql-test/r/func_time.result@stripped, 2006-10-17 16:30:46+05:00, ramil@stripped +3 -0 Fix for bug #22229: Bug in DATE_ADD() - test result. mysql-test/t/func_time.test@stripped, 2006-10-17 16:30:46+05:00, ramil@stripped +6 -0 Fix for bug #22229: Bug in DATE_ADD() - test case. sql/item_timefunc.cc@stripped, 2006-10-17 16:30:46+05:00, ramil@stripped +3 -1 Fix for bug #22229: Bug in DATE_ADD() - Item_func_str_to_date::get_date() should return NULL if TIME_NO_ZERO_DATE flag is set and year||month||day is 0. # 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: ramil # Host: myoffice.izhnet.ru # Root: /usr/home/ram/work/bug22229/my50-bug22229 --- 1.126/sql/item_timefunc.cc 2006-10-17 16:30:56 +05:00 +++ 1.127/sql/item_timefunc.cc 2006-10-17 16:30:56 +05:00 @@ -3193,7 +3193,9 @@ bool Item_func_str_to_date::get_date(TIM date_time_format.format.str= (char*) format->ptr(); date_time_format.format.length= format->length(); if (extract_date_time(&date_time_format, val->ptr(), val->length(), - ltime, cached_timestamp_type, 0, "datetime")) + ltime, cached_timestamp_type, 0, "datetime") || + ((fuzzy_date & TIME_NO_ZERO_DATE) && + (ltime->year == 0 || ltime->month == 0 || ltime->day == 0))) goto null_date; if (cached_timestamp_type == MYSQL_TIMESTAMP_TIME && ltime->day) { --- 1.70/mysql-test/r/func_time.result 2006-10-17 16:30:56 +05:00 +++ 1.71/mysql-test/r/func_time.result 2006-10-17 16:30:56 +05:00 @@ -1076,3 +1076,6 @@ fmtddate field2 Sep-4 12:00AM abcd DROP TABLE testBug8868; SET NAMES DEFAULT; +select str_to_date('10:00 PM', '%h:%i %p') + INTERVAL 10 MINUTE; +str_to_date('10:00 PM', '%h:%i %p') + INTERVAL 10 MINUTE +NULL --- 1.58/mysql-test/t/func_time.test 2006-10-17 16:30:56 +05:00 +++ 1.59/mysql-test/t/func_time.test 2006-10-17 16:30:56 +05:00 @@ -620,3 +620,9 @@ SELECT DATE_FORMAT(field1,'%b-%e %l:%i%p DROP TABLE testBug8868; SET NAMES DEFAULT; + +# +# Bug #22229: bug in DATE_ADD() +# + +select str_to_date('10:00 PM', '%h:%i %p') + INTERVAL 10 MINUTE;