summaryrefslogtreecommitdiff
path: root/mysql-test/include
diff options
context:
space:
mode:
authorIgor Babaev <igor@askmonty.org>2011-11-06 01:23:03 -0700
committerIgor Babaev <igor@askmonty.org>2011-11-06 01:23:03 -0700
commite0c1b3f24246d22e6785315f9a8448bd9a590422 (patch)
tree3647722d252e18907dd1e405a012d7f5ca5610af /mysql-test/include
parent928e94fb98b34e511d89c1ca38e35b42656c9313 (diff)
downloadmariadb-git-e0c1b3f24246d22e6785315f9a8448bd9a590422.tar.gz
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 .
Diffstat (limited to 'mysql-test/include')
-rw-r--r--mysql-test/include/icp_tests.inc27
1 files changed, 27 insertions, 0 deletions
diff --git a/mysql-test/include/icp_tests.inc b/mysql-test/include/icp_tests.inc
index 2814c4f10b5..3a278d5f10c 100644
--- a/mysql-test/include/icp_tests.inc
+++ b/mysql-test/include/icp_tests.inc
@@ -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;