Commit d87c53cb authored by Alexander Barkov's avatar Alexander Barkov

MDEV-16984 Assertion `dec' failed in Dec_ptr::cmp

Fixing the bug (in the code from MDEV-16910)
parent d6d63f48
......@@ -1204,5 +1204,19 @@ Warnings:
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where <cache>(octet_length(10.0)) + `test`.`t1`.`a` <=> <cache>(octet_length(10.00)) + `test`.`t1`.`a`
DROP TABLE t1;
#
# MDEV-16984 Assertion `dec' failed in Dec_ptr::cmp
#
SET sql_mode='';
CREATE TABLE t1 (dc decimal(10));
INSERT INTO t1 VALUES (0000000),(NULL);
SELECT 1 FROM t1 GROUP BY 'm' <=> dc;
1
1
1
Warnings:
Warning 1292 Truncated incorrect DECIMAL value: 'm'
DROP TABLE t1;
SET sql_mode=DEFAULT;
#
# End of 10.4 tests
#
......@@ -744,6 +744,17 @@ EXECUTE IMMEDIATE 'EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(10.0)+a<=>LENG
DROP TABLE t1;
--echo #
--echo # MDEV-16984 Assertion `dec' failed in Dec_ptr::cmp
--echo #
SET sql_mode='';
CREATE TABLE t1 (dc decimal(10));
INSERT INTO t1 VALUES (0000000),(NULL);
SELECT 1 FROM t1 GROUP BY 'm' <=> dc;
DROP TABLE t1;
SET sql_mode=DEFAULT;
--echo #
--echo # End of 10.4 tests
--echo #
......@@ -823,7 +823,7 @@ int Arg_comparator::compare_e_real()
int Arg_comparator::compare_e_decimal()
{
VDec val1(*a), val2(*b);
if (val1.is_null() || val1.is_null())
if (val1.is_null() || val2.is_null())
return MY_TEST(val1.is_null() && val2.is_null());
return MY_TEST(val1.cmp(val2) == 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