From: Date: October 5 2006 12:29pm Subject: bk commit into 4.1 tree (ramil:1.2543) BUG#22029 List-Archive: http://lists.mysql.com/commits/13104 X-Bug: 22029 Message-Id: <200610051029.k95ATJoG000650@myoffice.izhnet.ru> Below is the list of changes that have just been committed into a local 4.1 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-05 15:29:00+05:00, ramil@stripped +3 -0 Fix for bug #22029: str_to_date returning NULL, while date_format works using identical format. The problem appears when we have a space followed by a non-format symbol. Fix: properly skip spaces. mysql-test/r/date_formats.result@stripped, 2006-10-05 15:28:48+05:00, ramil@stripped +9 -0 Fix for bug #22029: str_to_date returning NULL, while date_format works using identical format. - test result. mysql-test/t/date_formats.test@stripped, 2006-10-05 15:28:48+05:00, ramil@stripped +8 -0 Fix for bug #22029: str_to_date returning NULL, while date_format works using identical format. - test case. sql/item_timefunc.cc@stripped, 2006-10-05 15:28:48+05:00, ramil@stripped +4 -4 Fix for bug #22029: str_to_date returning NULL, while date_format works using identical format. - skipping pre-spaces between each argument moved. # 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/bug22029/my41-bug22029 --- 1.104/sql/item_timefunc.cc 2006-10-05 15:29:23 +05:00 +++ 1.105/sql/item_timefunc.cc 2006-10-05 15:29:23 +05:00 @@ -171,14 +171,14 @@ static bool extract_date_time(DATE_TIME_ for (; ptr != end && val != val_end; ptr++) { + /* Skip pre-space between each argument */ + while (val != val_end && my_isspace(cs, *val)) + val++; + if (*ptr == '%' && ptr+1 != end) { int val_len; char *tmp; - - /* Skip pre-space between each argument */ - while (val != val_end && my_isspace(cs, *val)) - val++; val_len= (uint) (val_end - val); switch (*++ptr) { --- 1.22/mysql-test/r/date_formats.result 2006-10-05 15:29:23 +05:00 +++ 1.23/mysql-test/r/date_formats.result 2006-10-05 15:29:23 +05:00 @@ -530,4 +530,13 @@ DATE_FORMAT('%Y-%m-%d %H:%i:%s', 1151414 NULL Warnings: Warning 1292 Truncated incorrect datetime value: '%Y-%m-%d %H:%i:%s' +select str_to_date('04 /30/2004', '%m /%d/%Y'); +str_to_date('04 /30/2004', '%m /%d/%Y') +2004-04-30 +select str_to_date('04/30 /2004', '%m /%d /%Y'); +str_to_date('04/30 /2004', '%m /%d /%Y') +2004-04-30 +select str_to_date('04/30/2004 ', '%m/%d/%Y '); +str_to_date('04/30/2004 ', '%m/%d/%Y ') +2004-04-30 "End of 4.1 tests" --- 1.19/mysql-test/t/date_formats.test 2006-10-05 15:29:24 +05:00 +++ 1.20/mysql-test/t/date_formats.test 2006-10-05 15:29:24 +05:00 @@ -317,4 +317,12 @@ SELECT TIME_FORMAT("25:00:00", '%l %p'); # SELECT DATE_FORMAT('%Y-%m-%d %H:%i:%s', 1151414896); +# +# Bug #22029: str_to_date returning NULL +# + +select str_to_date('04 /30/2004', '%m /%d/%Y'); +select str_to_date('04/30 /2004', '%m /%d /%Y'); +select str_to_date('04/30/2004 ', '%m/%d/%Y '); + --echo "End of 4.1 tests"