1
0
mirror of https://github.com/MariaDB/server.git synced 2025-11-27 05:41:41 +03:00

MDEV-7152 Wrong result set for WHERE a='oe' COLLATE utf8_german2_ci AND a='oe'

- The code that tested if
     WHERE expr=value AND expr=const
  can be rewritten to:
     WHERE const=value AND expr=const
  was incomplete in case of STRING_RESULT.
- Moving the test into a new function, to reduce duplicate code.
This commit is contained in:
Alexander Barkov
2015-01-18 01:54:11 +04:00
parent 09d54b37f5
commit c11a054a98
3 changed files with 116 additions and 16 deletions

View File

@@ -13136,5 +13136,28 @@ SELECT BINARY 'A' = 'a';
BINARY 'A' = 'a'
0
#
# Wrong result set for WHERE a='oe' COLLATE utf8_german2_ci AND a='oe'
#
SET NAMES utf8 COLLATE utf8_german2_ci;
CREATE TABLE t1 (a CHAR(10) CHARACTER SET utf8);
INSERT INTO t1 VALUES ('ö'),('oe');
SELECT * FROM t1 WHERE a='oe' AND a='oe' COLLATE utf8_german2_ci;
a
oe
SELECT * FROM t1 WHERE a='oe' COLLATE utf8_german2_ci AND a='oe';
a
oe
EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='oe' AND a='oe' COLLATE utf8_german2_ci;
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` = 'oe') and (`test`.`t1`.`a` = 'oe'))
EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='oe' COLLATE utf8_german2_ci AND a='oe';
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` = 'oe') and (`test`.`t1`.`a` = 'oe'))
DROP TABLE t1;
#
# End of MariaDB-10.0 tests
#