Commit 13f36fff authored by Alexander Barkov's avatar Alexander Barkov

MDEV-19301 Assertion `!is_valid_datetime() ||...

MDEV-19301 Assertion `!is_valid_datetime() || fraction_remainder(((item->decimals) < (6) ? (item->decimals) : (6))) == 0' failed in Datetime_truncation_not_needed::Datetime_truncation_not_needed
parent c99f9766
......@@ -1025,5 +1025,20 @@ INSERT INTO t1 SELECT * FROM t2;
DROP TABLE t1,t2;
SET sql_mode=DEFAULT;
#
# MDEV-19301 Assertion `!is_valid_datetime() || fraction_remainder(((item->decimals) < (6) ? (item->decimals) : (6))) == 0' failed in Datetime_truncation_not_needed::Datetime_truncation_not_needed
#
SELECT NULLIF(CAST(1012.5 AS DATE), 1);
NULLIF(CAST(1012.5 AS DATE), 1)
2000-10-12
Warnings:
Note 1292 Truncated incorrect date value: '1012.5'
Warning 1292 Truncated incorrect datetime value: '1'
Note 1292 Truncated incorrect date value: '1012.5'
SELECT CAST(1012.5 AS DATE) * 1.0;
CAST(1012.5 AS DATE) * 1.0
20001012.0
Warnings:
Note 1292 Truncated incorrect date value: '1012.5'
#
# End of 10.4 tests
#
......@@ -691,6 +691,14 @@ DROP TABLE t1,t2;
SET sql_mode=DEFAULT;
--echo #
--echo # MDEV-19301 Assertion `!is_valid_datetime() || fraction_remainder(((item->decimals) < (6) ? (item->decimals) : (6))) == 0' failed in Datetime_truncation_not_needed::Datetime_truncation_not_needed
--echo #
SELECT NULLIF(CAST(1012.5 AS DATE), 1);
SELECT CAST(1012.5 AS DATE) * 1.0;
--echo #
--echo # End of 10.4 tests
--echo #
......@@ -1728,7 +1728,11 @@ longlong number_to_datetime_or_date(longlong nr, ulong sec_part,
!check_date(time_res, nr || sec_part, flags, was_cut))
{
if (time_res->time_type == MYSQL_TIMESTAMP_DATE && sec_part != 0)
*was_cut= MYSQL_TIME_NOTE_TRUNCATED;
{
/* Date format, but with fractional digits, e.g. 20010203.5 */
*was_cut= MYSQL_TIME_NOTE_TRUNCATED;
time_res->second_part= 0;
}
return nr;
}
......
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