1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

MDEV-17854 Assertion `decimals <= 6' failed in my_time_fraction_remainder on SELECT with NULLIF and FROM_UNIXTIME on incorrect time

This commit is contained in:
Alexander Barkov
2018-11-28 06:18:05 +04:00
parent 926b04e550
commit d6bcf3a4c8
3 changed files with 19 additions and 1 deletions

View File

@ -6295,3 +6295,12 @@ Warning 1292 Truncated incorrect time value: '50326 garbage'
SELECT TIME('- 01:00:00'), TIME('- 1 01:00:00');
TIME('- 01:00:00') TIME('- 1 01:00:00')
-01:00:00 -25:00:00
#
# MDEV-17854 Assertion `decimals <= 6' failed in my_time_fraction_remainder on SELECT with NULLIF and FROM_UNIXTIME on incorrect time
#
SELECT NULLIF(FROM_UNIXTIME('foo'), '2012-12-12 21:10:14');
NULLIF(FROM_UNIXTIME('foo'), '2012-12-12 21:10:14')
1970-01-01 04:00:00
Warnings:
Warning 1292 Truncated incorrect DECIMAL value: 'foo'
Warning 1292 Truncated incorrect DECIMAL value: 'foo'

View File

@ -3123,3 +3123,10 @@ SELECT
CAST('50326 garbage' as time);
SELECT TIME('- 01:00:00'), TIME('- 1 01:00:00');
--echo #
--echo # MDEV-17854 Assertion `decimals <= 6' failed in my_time_fraction_remainder on SELECT with NULLIF and FROM_UNIXTIME on incorrect time
--echo #
SELECT NULLIF(FROM_UNIXTIME('foo'), '2012-12-12 21:10:14');

View File

@ -862,7 +862,9 @@ Datetime_truncation_not_needed::Datetime_truncation_not_needed(THD *thd, Item *i
existed (but we know there were no nanoseconds). Here we assert that there
are also no microsecond digits outside of the scale specified in "dec".
*/
DBUG_ASSERT(!is_valid_datetime() || fraction_remainder(item->decimals) == 0);
DBUG_ASSERT(!is_valid_datetime() ||
fraction_remainder(MY_MIN(item->decimals,
TIME_SECOND_PART_DIGITS)) == 0);
}
/********************************************************************/