mirror of
https://github.com/MariaDB/server.git
synced 2026-01-06 05:22:24 +03:00
Fixed LP bug #886145.
The bug happened because in some cases the function JOIN::exec did not save the value of TABLE::pre_idx_push_select_cond in TABLE::select->pre_idx_push_select_cond for the sort table. Noticed and fixed a bug in the function make_cond_remainder that builds the remainder condition after extraction of an index pushdown condition from the where condition. The code erroneously assumed that the function make_cond_for_table left the value of ICP_COND_USES_INDEX_ONLY in sub-condition markers. Adjusted many result files from the regression test suite after this fix .
This commit is contained in:
@@ -697,3 +697,30 @@ SELECT * FROM t1
|
||||
ORDER BY a;
|
||||
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo #
|
||||
--echo # Bug#886145: join with ICP + ORDER BY
|
||||
--echo #
|
||||
|
||||
CREATE TABLE t1 (b int NOT NULL, c int, a varchar(1024), PRIMARY KEY (b));
|
||||
INSERT INTO t1 VALUES (1,4,'Ill');
|
||||
|
||||
CREATE TABLE t2 (a varchar(1024), KEY (a(512)));
|
||||
INSERT INTO t2 VALUES
|
||||
('Ill'), ('eckqzsflbzaffti'), ('w'), ('she'), ('gxbwypqtjzwywwer'), ('w');
|
||||
|
||||
SET SESSION optimizer_switch='index_condition_pushdown=off';
|
||||
EXPLAIN
|
||||
SELECT t1.b, t1.c FROM t1, t2 WHERE t1.a = t2.a AND t1.b != 0
|
||||
HAVING t1.c != 5 ORDER BY t1.c;
|
||||
SELECT t1.b, t1.c FROM t1, t2 WHERE t1.a = t2.a AND t1.b != 0
|
||||
HAVING t1.c != 5 ORDER BY t1.c;
|
||||
|
||||
SET SESSION optimizer_switch='index_condition_pushdown=on';
|
||||
EXPLAIN
|
||||
SELECT t1.b, t1.c FROM t1, t2 WHERE t1.a = t2.a AND t1.b != 0
|
||||
HAVING t1.c != 5 ORDER BY t1.c;
|
||||
SELECT t1.b, t1.c FROM t1, t2 WHERE t1.a = t2.a AND t1.b != 0
|
||||
HAVING t1.c != 5 ORDER BY t1.c;
|
||||
|
||||
DROP TABLE t1,t2;
|
||||
|
||||
Reference in New Issue
Block a user