Commit 786940d7 authored by Alexander Barkov's avatar Alexander Barkov

MDEV-17219 Assertion `!t->fraction_remainder(decimals())' failed in...

MDEV-17219 Assertion `!t->fraction_remainder(decimals())' failed in Field_time::store_TIME_with_warning
parent 25ad38ab
......@@ -2076,5 +2076,17 @@ d1 t1 d1
UPDATE (t1 JOIN t2 ON (t2.d1 = t1.t1)) SET t1.d1 = '2018-07-07' WHERE (t1.d1 > 70 );
DROP TABLE t1,t2;
#
# MDEV-17219 Assertion `!t->fraction_remainder(decimals())' failed in Field_time::store_TIME_with_warning
#
SET optimizer_use_condition_selectivity=3;
CREATE TABLE t1 (it TIME NOT NULL);
INSERT INTO t1 VALUES ('07:25:13'),('05:15:55'),('09:58:01'),('04:23:57'),('19:37:28'),('01:38:05'),('20:50:52');
SELECT 1 FROM t1 WHERE it < -7487797330456870912;
1
Warnings:
Warning 1292 Truncated incorrect time value: '-7487797330456870912'
DROP TABLE t1;
SET optimizer_use_condition_selectivity=DEFAULT;
#
# End of 10.4 tests
#
......@@ -1351,6 +1351,17 @@ SELECT * FROM (t1 JOIN t2 ON (t2.d1 = t1.t1)) WHERE (t1.d1 > 70 );
UPDATE (t1 JOIN t2 ON (t2.d1 = t1.t1)) SET t1.d1 = '2018-07-07' WHERE (t1.d1 > 70 );
DROP TABLE t1,t2;
--echo #
--echo # MDEV-17219 Assertion `!t->fraction_remainder(decimals())' failed in Field_time::store_TIME_with_warning
--echo #
SET optimizer_use_condition_selectivity=3;
CREATE TABLE t1 (it TIME NOT NULL);
INSERT INTO t1 VALUES ('07:25:13'),('05:15:55'),('09:58:01'),('04:23:57'),('19:37:28'),('01:38:05'),('20:50:52');
SELECT 1 FROM t1 WHERE it < -7487797330456870912;
DROP TABLE t1;
SET optimizer_use_condition_selectivity=DEFAULT;
--echo #
--echo # End of 10.4 tests
--echo #
......@@ -5735,7 +5735,8 @@ int Field_time::store(longlong nr, bool unsigned_val)
{
ErrConvInteger str(nr, unsigned_val);
int was_cut;
Time tm(&was_cut, nr, unsigned_val);
// Need fractional digit truncation if nr overflows to '838:59:59.999999'
Time tm(&was_cut, nr, unsigned_val, decimals());
return store_TIME_with_warning(&tm, &str, was_cut);
}
......
......@@ -800,6 +800,15 @@ class Time: public Temporal
{
trunc(dec);
}
Time(int *warn, longlong nr, bool unsigned_val, uint dec)
:Time(warn, nr, unsigned_val)
{
/*
Decimal digit truncation is needed here in case if nr was out
of the supported TIME range, so "this" was set to '838:59:59.999999'.
*/
trunc(dec);
}
Time(int *warn, const my_decimal *d, uint dec)
:Temporal(Time(warn, d))
{
......
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