1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

MDEV-17219 Assertion `!t->fraction_remainder(decimals())' failed in Field_time::store_TIME_with_warning

This commit is contained in:
Alexander Barkov
2018-09-26 20:14:47 +04:00
parent 25ad38abe5
commit 786940d7e0
4 changed files with 34 additions and 1 deletions

View File

@ -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
#

View File

@ -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 #

View File

@ -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);
}

View File

@ -800,6 +800,15 @@ public:
{
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))
{