@@ -812,3 +812,27 @@ EXECUTE s;
812
812
1
813
813
DROP TABLE t1;
814
814
# End of 5.3 tests
815
+ #
816
+ # MDEV-8755 Equal field propagation is not performed any longer for the IN list when multiple comparison types
817
+ #
818
+ CREATE TABLE t1 (a INT);
819
+ INSERT INTO t1 VALUES (1),(2);
820
+ # Ok to propagate equalities into the left IN argument in case of a single comparison type
821
+ EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=1 AND a IN (1,2,3);
822
+ id select_type table type possible_keys key key_len ref rows filtered Extra
823
+ 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
824
+ Warnings:
825
+ Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = 1)
826
+ # Ok to propagate equalities into IN () list, even if multiple comparison types
827
+ EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=1 AND 1 IN (1,a,'3');
828
+ id select_type table type possible_keys key key_len ref rows filtered Extra
829
+ 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
830
+ Warnings:
831
+ Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = 1)
832
+ # Not Ok to propagate equalities into the left IN argument in case of multiple comparison types
833
+ EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=1 AND a IN (1,2,'3');
834
+ id select_type table type possible_keys key key_len ref rows filtered Extra
835
+ 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
836
+ Warnings:
837
+ Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = 1) and (`test`.`t1`.`a` in (1,2,'3')))
838
+ DROP TABLE t1;
0 commit comments