mirror of
https://github.com/MariaDB/server.git
synced 2025-07-27 18:02:13 +03:00
MDEV-16971 Assertion `is_valid_value_slow()' failed in Time::adjust_time_range_or_invalidate
The patch for MDEV-16928 added a few new asserts to check that time, date, datetime values are valid and consistent after initialization. One of the new asserts caught an improper initialization in Time::make_from_datetime_with_days_diff() (the former function calc_datetime_days_diff()). If the YYYYMM part is not zero after unpack time we have an out-of-range TIME value.
This commit is contained in:
@ -404,6 +404,12 @@ void Time::make_from_datetime_with_days_diff(int *warn, const MYSQL_TIME *from,
|
||||
from->second) * 1000000LL +
|
||||
from->second_part);
|
||||
unpack_time(timediff, this, MYSQL_TIMESTAMP_TIME);
|
||||
if (year || month)
|
||||
{
|
||||
*warn|= MYSQL_TIME_WARN_OUT_OF_RANGE;
|
||||
year= month= day= 0;
|
||||
hour= TIME_MAX_HOUR + 1;
|
||||
}
|
||||
}
|
||||
// The above code can generate TIME values outside of the valid TIME range.
|
||||
adjust_time_range_or_invalidate(warn);
|
||||
|
Reference in New Issue
Block a user