Commit 787adc61 authored by Alexander Barkov's avatar Alexander Barkov

MDEV-8680 Wrong result for SELECT..WHERE a IN ('a' COLLATE latin1_bin,'b') AND a='a'

The fix for MDEV-8688 fixed MDEV-8680 as well. Just adding a test case.
parent f071a124
......@@ -8001,5 +8001,23 @@ Warnings:
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = '10')
DROP TABLE t1;
#
# MDEV-8680 Wrong result for SELECT..WHERE a IN ('a' COLLATE latin1_bin,'b') AND a='a'
#
SET NAMES latin1;
CREATE TABLE t1 (a VARCHAR(10));
INSERT INTO t1 VALUES ('a'),('A');
SELECT * FROM t1 WHERE a IN ('a' COLLATE latin1_bin,'b');
a
a
SELECT * FROM t1 WHERE a IN ('a' COLLATE latin1_bin,'b') AND a='a';
a
a
EXPLAIN EXTENDED SELECT * FROM t1 WHERE a IN ('a' COLLATE latin1_bin,'b') AND a='a';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = 'a') and (`test`.`t1`.`a` in (<cache>(('a' collate latin1_bin)),'b')))
DROP TABLE t1;
#
# End of 10.1 tests
#
......@@ -276,6 +276,17 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='10' AND IF(a='10',1,0)=1;
EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='10' AND CASE WHEN a='10' THEN 1 ELSE 0 END;
DROP TABLE t1;
--echo #
--echo # MDEV-8680 Wrong result for SELECT..WHERE a IN ('a' COLLATE latin1_bin,'b') AND a='a'
--echo #
SET NAMES latin1;
CREATE TABLE t1 (a VARCHAR(10));
INSERT INTO t1 VALUES ('a'),('A');
SELECT * FROM t1 WHERE a IN ('a' COLLATE latin1_bin,'b');
SELECT * FROM t1 WHERE a IN ('a' COLLATE latin1_bin,'b') AND a='a';
EXPLAIN EXTENDED SELECT * FROM t1 WHERE a IN ('a' COLLATE latin1_bin,'b') AND a='a';
DROP TABLE t1;
--echo #
--echo # End of 10.1 tests
--echo #
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