You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
MDEV-38199 Optimizer Error with = SOME on UNIQUE Column Using Decimal/Integer Types
return 2 (= value was truncated) when a decimal or float number
was modified when stored in Field_long (= fractional part was lost).
This tells the optimizer that a number with a non-zero fractional
part cannot be found in an index over an integer field.
Copy file name to clipboardExpand all lines: mysql-test/main/null.result
+7-6Lines changed: 7 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -1647,18 +1647,18 @@ DROP TABLE t1;
1647
1647
#
1648
1648
CREATE TABLE t1 (a YEAR);
1649
1649
INSERT INTO t1 VALUES (2010),(2020);
1650
-
SELECT * FROM t1 WHERE a=2010 AND NULLIF(10.1,a) IS NULL;
1650
+
SELECT * FROM t1 WHERE a=2010 AND NULLIF(10,a) IS NULL;
1651
1651
a
1652
1652
2010
1653
-
EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=2010 AND NULLIF(10.1,a) IS NULL;
1653
+
EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=2010 AND NULLIF(10,a) IS NULL;
1654
1654
id select_type table type possible_keys key key_len ref rows filtered Extra
1655
1655
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
1656
1656
Warnings:
1657
1657
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 2010
1658
-
SELECT * FROM t1 WHERE a=2010 AND CASE WHEN 10.1=a THEN NULL ELSE 10.1 END IS NULL;
1658
+
SELECT * FROM t1 WHERE a=2010 AND CASE WHEN 10=a THEN NULL ELSE 10 END IS NULL;
1659
1659
a
1660
1660
2010
1661
-
EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=2010 AND CASE WHEN 10.1=a THEN NULL ELSE 10.1 END IS NULL;
1661
+
EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=2010 AND CASE WHEN 10=a THEN NULL ELSE 10 END IS NULL;
1662
1662
id select_type table type possible_keys key key_len ref rows filtered Extra
1663
1663
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
1664
1664
Warnings:
@@ -1708,20 +1708,21 @@ a
1708
1708
2010
1709
1709
SELECT * FROM t1 WHERE NULLIF(a,2011.1)='2011';
1710
1710
a
1711
+
2011
1711
1712
SELECT * FROM t1 WHERE a=10 AND NULLIF(a,2011.1)='2011';
1712
1713
a
1713
1714
EXPLAIN EXTENDED
1714
1715
SELECT * FROM t1 WHERE a=10 AND NULLIF(a,2011.1)='2011';
1715
1716
id select_type table type possible_keys key key_len ref rows filtered Extra
1716
1717
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
1717
1718
Warnings:
1718
-
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 2010 and (case when 2010 = 2011 then NULL else `test`.`t1`.`a` end) = '2011'
1719
+
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 2010 and nullif(`test`.`t1`.`a`,2011.1) = '2011'
1719
1720
EXPLAIN EXTENDED
1720
1721
SELECT * FROM t1 WHERE a=10 AND NULLIF(a,2011.1)=CONCAT('2011',RAND());
1721
1722
id select_type table type possible_keys key key_len ref rows filtered Extra
1722
1723
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
1723
1724
Warnings:
1724
-
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 2010 and (case when 2010 = 2011 then NULL else `test`.`t1`.`a` end) = concat('2011',rand())
1725
+
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 2010 and nullif(`test`.`t1`.`a`,2011.1) = concat('2011',rand())
1725
1726
DROP TABLE t1;
1726
1727
#
1727
1728
# MDEV-8754 Wrong result for SELECT..WHERE year_field=2020 AND NULLIF(year_field,2010)='2020'
0 commit comments