MDEV-454 Addition of a time interval reduces the resulting value

1. Field_newdate::get_date should refuse to return a date with zeros when
   TIME_NO_ZERO_IN_DATE is set, not when TIME_FUZZY_DATE is unset
2. Item_func_to_days and Item_date_add_interval can only work with valid dates,
   no zeros allowed.
This commit is contained in:
Sergei Golubchik 2012-08-29 17:55:59 +02:00
commit 3444e8e925
4 changed files with 22 additions and 3 deletions

View file

@ -5789,7 +5789,7 @@ bool Field_newdate::get_date(MYSQL_TIME *ltime,uint fuzzydate)
if (!tmp)
return fuzzydate & TIME_NO_ZERO_DATE;
if (!ltime->month || !ltime->day)
return !(fuzzydate & TIME_FUZZY_DATE);
return fuzzydate & TIME_NO_ZERO_IN_DATE;
return 0;
}