Wrong result with icp, ranges in maria-5.3-icp
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
MariaDB |
Fix Released
|
High
|
Igor Babaev |
Bug Description
The following query:
SELECT * FROM t1 WHERE NOT ( b = 'Texas' ) AND b BETWEEN 'wy' AND 'y' OR ( b = 'Pennsylvania' ) ORDER BY a;
returns
a b
d xdmbdkpjda
f Pennsylvan
when executed with ICP in maria-5.3-icp and
a b
d xdmbdkpjda
otherwise. The table contains a string "Pennsylvan" which is a subset of "Pennsylvania"
EXPLAIN with ICP: note that ICP is not shown anywhere:
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 range b b 13 NULL 2 100.00 Using filesort
Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where (((`test`.`t1`.`b` <> 'Texas') and (`test`.`t1`.`b` between 'wy' nd 'y')) or (`test`.`t1`.`b` = 'Pennsylvania')) order by `test`.`t1`.`a`
EXPLAIN without ICP:
EXPLAIN EXTENDED SELECT * FROM t1 WHERE NOT ( b = 'Texas' ) AND b BETWEEN 'wy' AND 'y' OR ( b = 'Pennsylvania' ) ORDER BY a;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 range b b 13 NULL 2 100.00 Using where; Using filesort
Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where (((`test`.`t1`.`b` <> 'Texas') and (`test`.`t1`.`b` between 'wy' nd 'y')) or (`test`.`t1`.`b` = 'Pennsylvania')) order by `test`.`t1`.`a`
minimal switch:
full switch:
index_merge=
bzr version-info
revision-id: <email address hidden>
date: 2011-11-02 01:22:11 -0700
build-date: 2011-11-02 13:53:50 +0200
revno: 3267
branch-nick: maria-5.3-icp
test case:
CREATE TABLE t1 ( a varchar(64), b varchar(10), KEY (a), KEY (b)) ;
INSERT INTO t1 VALUES ('Ohio'
SET SESSION optimizer_
SELECT * FROM t1 WHERE NOT ( b = 'Texas' ) AND b BETWEEN 'wy' AND 'y' OR ( b = 'Pennsylvania' ) ORDER BY a;
SET SESSION optimizer_
SELECT * FROM t1 WHERE NOT ( b = 'Texas' ) AND b BETWEEN 'wy' AND 'y' OR ( b = 'Pennsylvania' ) ORDER BY a;
Related branches
Changed in maria: | |
status: | New → Confirmed |
importance: | Undecided → High |
Changed in maria: | |
status: | Confirmed → In Progress |
Changed in maria: | |
status: | In Progress → Fix Committed |
Changed in maria: | |
status: | Fix Committed → Fix Released |
See also https:/ /bugs.launchpad .net/maria/ +bug/884175