Commit a48bff1d authored by Sergey Glukhov's avatar Sergey Glukhov

5.1 -> 5.5 merge

parents b1ad5f2e a7cd008e
...@@ -1389,6 +1389,15 @@ NULL ...@@ -1389,6 +1389,15 @@ NULL
SELECT DATE_FORMAT('0000-00-11', '%w'); SELECT DATE_FORMAT('0000-00-11', '%w');
DATE_FORMAT('0000-00-11', '%w') DATE_FORMAT('0000-00-11', '%w')
NULL 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 End of 5.1 tests
# #
# Bug#57039: constant subtime expression returns incorrect result. # Bug#57039: constant subtime expression returns incorrect result.
......
...@@ -902,6 +902,13 @@ SELECT DATE_FORMAT('0000-00-11', '%W'); ...@@ -902,6 +902,13 @@ SELECT DATE_FORMAT('0000-00-11', '%W');
SELECT DATE_FORMAT('0000-00-11', '%a'); SELECT DATE_FORMAT('0000-00-11', '%a');
SELECT DATE_FORMAT('0000-00-11', '%w'); 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 --echo End of 5.1 tests
--echo # --echo #
......
...@@ -1591,6 +1591,11 @@ bool Item_func_from_days::get_date(MYSQL_TIME *ltime, uint fuzzy_date) ...@@ -1591,6 +1591,11 @@ bool Item_func_from_days::get_date(MYSQL_TIME *ltime, uint fuzzy_date)
return 1; return 1;
bzero(ltime, sizeof(MYSQL_TIME)); bzero(ltime, sizeof(MYSQL_TIME));
get_date_from_daynr((long) value, &ltime->year, &ltime->month, &ltime->day); get_date_from_daynr((long) value, &ltime->year, &ltime->month, &ltime->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; ltime->time_type= MYSQL_TIMESTAMP_DATE;
return 0; return 0;
} }
...@@ -2779,7 +2784,7 @@ String *Item_func_makedate::val_str(String *str) ...@@ -2779,7 +2784,7 @@ String *Item_func_makedate::val_str(String *str)
long days; long days;
if (args[0]->null_value || args[1]->null_value || if (args[0]->null_value || args[1]->null_value ||
year < 0 || daynr <= 0) year < 0 || year > 9999 || daynr <= 0)
goto err; goto err;
if (year < 100) if (year < 100)
...@@ -2822,7 +2827,7 @@ longlong Item_func_makedate::val_int() ...@@ -2822,7 +2827,7 @@ longlong Item_func_makedate::val_int()
long days; long days;
if (args[0]->null_value || args[1]->null_value || if (args[0]->null_value || args[1]->null_value ||
year < 0 || daynr <= 0) year < 0 || year > 9999 || daynr <= 0)
goto err; goto err;
if (year < 100) if (year < 100)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment