Wrong result with materialization + utf8
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
MariaDB |
Invalid
|
Medium
|
Timour Katchaounov |
Bug Description
The following query:
SELECT * FROM t3 WHERE (a, c, d) IN (SELECT t1.c, t2.c, t1.d FROM t1 LEFT JOIN t2 ON t1.b = t2.e);
returns no rows when executed with materialization, even though it should return:
+------
| a | c | d |
+------
| h | your | XYFRD |
+------
explain:
| 1 | PRIMARY | t3 | system | NULL | NULL | NULL | NULL | 1 | |
| 2 | SUBQUERY | t1 | ALL | NULL | NULL | NULL | NULL | 54 | |
| 2 | SUBQUERY | t2 | ALL | NULL | NULL | NULL | NULL | 22 | Using where |
minimal optimizer_switch: in_to_exists=
full optimizer_switch: index_merge=
bzr version-info:
revision-id: <email address hidden>
date: 2011-08-12 14:31:40 +0300
build-date: 2011-08-14 10:53:15 +0300
revno: 3155
branch-nick: maria-5.3
test case:
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 ( a int(11) NOT NULL , b int(11), c varchar(1014) COLLATE utf8_general_ci, d varchar(1014) COLLATE utf8_general_ci) ;
INSERT INTO t1 VALUES (1,0,'m'
DROP TABLE IF EXISTS t2;
CREATE TABLE t2 ( b int(11), c varchar(1024) COLLATE utf8_general_ci, d varchar(1024) COLLATE utf8_general_ci, a int(11) NOT NULL , e int(11)) ;
INSERT INTO t2 VALUES (0,'s',
DROP TABLE IF EXISTS t3;
CREATE TABLE t3 ( a varchar(10) COLLATE utf8_general_ci, c varchar(10) COLLATE utf8_general_ci, d varchar(10) COLLATE utf8_general_ci);
INSERT INTO t3 VALUES ('h','your'
set session optimizer_
SELECT * FROM t3 WHERE (a, c, d) IN (SELECT t1.c, t2.c, t1.d FROM t1 LEFT JOIN t2 ON t1.b = t2.e);
The UTF8 columns, the 1024 argument to VARCHAR() and the 3-columns to the IN() all seem to be required. Further reducing the number of participating rows was not possible, No NULLs or constant tables are involved.
Changed in maria: | |
milestone: | none → 5.3 |
assignee: | nobody → Timour Katchaounov (timour) |
The bug is reproducible if one records the test case
as a separate test file with mtr. If the test case is run
from the mariadb console, it works correctly.