From: Sergey Glukhov Date: May 18 2011 7:08am Subject: bzr push into mysql-5.1 branch (sergey.glukhov:3621 to 3622) Bug#12403504 List-Archive: http://lists.mysql.com/commits/137649 X-Bug: 12403504 Message-Id: <201105180714.p4I7ETxL023155@acsmt357.oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 3622 Sergey Glukhov 2011-05-18 Bug#12403504 AFTER FIX FOR #11889186 : ASSERTION FAILED: DELSUM+(INT) Y/4-TEMP > 0 There are two problems: 1. There is a missing check for 'year' parameter(year can not be greater than 9999) in makedate function. fix: added check that year can not be greater than 9999. 2. There is a missing check for zero date in from_days() function. fix: added zero date check into Item_func_from_days::get_date() function. @ mysql-test/r/func_time.result test case @ mysql-test/t/func_time.test test case @ sql/item_timefunc.cc --added check that year can not be greater than 9999 for makedate() function --added zero date check into Item_func_from_days::get_date() function modified: mysql-test/r/func_time.result mysql-test/t/func_time.test sql/item_timefunc.cc 3621 Vinay Fisrekar 2011-05-14 Adding bug scenario for data types in main suite Impementing Test Review Comment. Bug test scenario: SELECT is not returning result set for "equal" (=) and "NULL safe equal operator" (<=>) on BIT data type. Extending this scenario for all data types added: mysql-test/r/implicit_char_to_num_conversion.result mysql-test/t/implicit_char_to_num_conversion.test === modified file 'mysql-test/r/func_time.result' --- a/mysql-test/r/func_time.result 2011-04-27 07:35:57 +0000 +++ b/mysql-test/r/func_time.result 2011-05-18 06:47:43 +0000 @@ -1417,4 +1417,13 @@ NULL SELECT DATE_FORMAT('0000-00-11', '%w'); DATE_FORMAT('0000-00-11', '%w') NULL +# +# Bug#12403504 AFTER FIX FOR #11889186 : ASSERTION FAILED: DELSUM+(INT) Y/4-TEMP > 0 +# +SELECT MAKEDATE(11111111,1); +MAKEDATE(11111111,1) +NULL +SELECT WEEK(DATE_ADD(FROM_DAYS(1),INTERVAL 1 MONTH), 1); +WEEK(DATE_ADD(FROM_DAYS(1),INTERVAL 1 MONTH), 1) +NULL End of 5.1 tests === modified file 'mysql-test/t/func_time.test' --- a/mysql-test/t/func_time.test 2011-04-27 07:35:57 +0000 +++ b/mysql-test/t/func_time.test 2011-05-18 06:47:43 +0000 @@ -921,4 +921,11 @@ SELECT DATE_FORMAT('0000-00-11', '%W'); SELECT DATE_FORMAT('0000-00-11', '%a'); SELECT DATE_FORMAT('0000-00-11', '%w'); +--echo # +--echo # Bug#12403504 AFTER FIX FOR #11889186 : ASSERTION FAILED: DELSUM+(INT) Y/4-TEMP > 0 +--echo # + +SELECT MAKEDATE(11111111,1); +SELECT WEEK(DATE_ADD(FROM_DAYS(1),INTERVAL 1 MONTH), 1); + --echo End of 5.1 tests === modified file 'sql/item_timefunc.cc' --- a/sql/item_timefunc.cc 2011-05-06 08:03:02 +0000 +++ b/sql/item_timefunc.cc 2011-05-18 06:47:43 +0000 @@ -1519,6 +1519,11 @@ bool Item_func_from_days::get_date(MYSQL return 1; bzero(ltime, sizeof(MYSQL_TIME)); get_date_from_daynr((long) value, <ime->year, <ime->month, <ime->day); + + if ((null_value= (fuzzy_date & TIME_NO_ZERO_DATE) && + (ltime->year == 0 || ltime->month == 0 || ltime->day == 0))) + return TRUE; + ltime->time_type= MYSQL_TIMESTAMP_DATE; return 0; } @@ -2697,7 +2702,7 @@ String *Item_func_makedate::val_str(Stri long days; if (args[0]->null_value || args[1]->null_value || - year < 0 || daynr <= 0) + year < 0 || year > 9999 || daynr <= 0) goto err; if (year < 100) @@ -2740,7 +2745,7 @@ longlong Item_func_makedate::val_int() long days; if (args[0]->null_value || args[1]->null_value || - year < 0 || daynr <= 0) + year < 0 || year > 9999 || daynr <= 0) goto err; if (year < 100) No bundle (reason: useless for push emails).