1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

Merge rkalimullin@bk-internal.mysql.com:/home/bk/mysql-4.1-maint

into  mysql.com:/usr/home/ram/work/bug23653/my41-bug23653
This commit is contained in:
unknown
2006-11-16 16:19:10 +04:00
3 changed files with 11 additions and 1 deletions

View File

@@ -815,4 +815,7 @@ union
(select time_format(timediff(now(), DATE_SUB(now(),INTERVAL 5 HOUR)),'%k') As H); (select time_format(timediff(now(), DATE_SUB(now(),INTERVAL 5 HOUR)),'%k') As H);
H H
5 5
select last_day('0000-00-00');
last_day('0000-00-00')
NULL
End of 4.1 tests End of 4.1 tests

View File

@@ -446,4 +446,10 @@ union
union union
(select time_format(timediff(now(), DATE_SUB(now(),INTERVAL 5 HOUR)),'%k') As H); (select time_format(timediff(now(), DATE_SUB(now(),INTERVAL 5 HOUR)),'%k') As H);
#
# Bug #23653: crash if last_day('0000-00-00')
#
select last_day('0000-00-00');
--echo End of 4.1 tests --echo End of 4.1 tests

View File

@@ -3058,7 +3058,8 @@ String *Item_func_str_to_date::val_str(String *str)
bool Item_func_last_day::get_date(TIME *ltime, uint fuzzy_date) bool Item_func_last_day::get_date(TIME *ltime, uint fuzzy_date)
{ {
if (get_arg0_date(ltime, fuzzy_date & ~TIME_FUZZY_DATE)) if (get_arg0_date(ltime, fuzzy_date & ~TIME_FUZZY_DATE) ||
(ltime->month == 0))
return 1; return 1;
uint month_idx= ltime->month-1; uint month_idx= ltime->month-1;
ltime->day= days_in_month[month_idx]; ltime->day= days_in_month[month_idx];