MDEV-4858 Wrong results for a huge unsigned value inserted into a TIME column

MDEV-6099 Bad results for DATE_ADD(.., INTERVAL 2000000000000000000.0 SECOND)
MDEV-6097 Inconsistent results for CAST(int,decimal,double AS DATETIME)
MDEV-6100 No warning on CAST(9000000 AS TIME)
This commit is contained in:
Alexander Barkov 2014-06-04 20:32:57 +04:00
commit 661daf16f1
20 changed files with 194 additions and 51 deletions

View file

@ -4149,8 +4149,10 @@ bool Item_dyncol_get::get_date(MYSQL_TIME *ltime, uint fuzzy_date)
case DYN_COL_UINT:
if (signed_value || val.x.ulong_value <= LONGLONG_MAX)
{
if (int_to_datetime_with_warn(val.x.ulong_value, ltime, fuzzy_date,
0 /* TODO */))
bool neg= val.x.ulong_value > LONGLONG_MAX;
if (int_to_datetime_with_warn(neg, neg ? -val.x.ulong_value :
val.x.ulong_value,
ltime, fuzzy_date, 0 /* TODO */))
goto null;
return 0;
}