Commit d6bcf3a4 authored by Alexander Barkov's avatar Alexander Barkov

MDEV-17854 Assertion `decimals <= 6' failed in my_time_fraction_remainder on...

MDEV-17854 Assertion `decimals <= 6' failed in my_time_fraction_remainder on SELECT with NULLIF and FROM_UNIXTIME on incorrect time
parent 926b04e5
...@@ -6295,3 +6295,12 @@ Warning 1292 Truncated incorrect time value: '50326 garbage' ...@@ -6295,3 +6295,12 @@ Warning 1292 Truncated incorrect time value: '50326 garbage'
SELECT TIME('- 01:00:00'), TIME('- 1 01:00:00'); SELECT TIME('- 01:00:00'), TIME('- 1 01:00:00');
TIME('- 01:00:00') TIME('- 1 01:00:00') TIME('- 01:00:00') TIME('- 1 01:00:00')
-01:00:00 -25: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'
...@@ -3123,3 +3123,10 @@ SELECT ...@@ -3123,3 +3123,10 @@ SELECT
CAST('50326 garbage' as time); CAST('50326 garbage' as time);
SELECT TIME('- 01:00:00'), TIME('- 1 01:00:00'); 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');
...@@ -862,7 +862,9 @@ Datetime_truncation_not_needed::Datetime_truncation_not_needed(THD *thd, Item *i ...@@ -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 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". 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);
} }
/********************************************************************/ /********************************************************************/
......
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