summaryrefslogtreecommitdiff
path: root/mysql-test/t/table_elim.test
diff options
context:
space:
mode:
authorSergey Petrunya <psergey@askmonty.org>2009-08-25 12:27:50 +0300
committerSergey Petrunya <psergey@askmonty.org>2009-08-25 12:27:50 +0300
commit9400700b995d00021819f4c483a07975a3ce60d7 (patch)
treec21a89566e435949732ddf6a2b4b1043af6268db /mysql-test/t/table_elim.test
parentd294aae6c8d085f2986bf7dbbb4e0cc30b061be5 (diff)
downloadmariadb-git-9400700b995d00021819f4c483a07975a3ce60d7.tar.gz
MWL#17: Table elimination
- Add more testcases. - Fix trivial compile failure - Remove handling of "column IN (one_element)". This is converted to equality elsewhere mysql-test/r/table_elim.result: MWL#17: Table elimination - Add more testcases. - Fix trivial compile failure mysql-test/t/table_elim.test: MWL#17: Table elimination - Add more testcases sql/mysqld.cc: MWL#17: Table elimination - Fix trivial compile failure sql/opt_table_elimination.cc: MWL#17: Table elimination - Add more testcases. - Remove handling of "column IN (one_element)".This is converted to equality elsewhere
Diffstat (limited to 'mysql-test/t/table_elim.test')
-rw-r--r--mysql-test/t/table_elim.test27
1 files changed, 27 insertions, 0 deletions
diff --git a/mysql-test/t/table_elim.test b/mysql-test/t/table_elim.test
index cc4a179d825..04a02233586 100644
--- a/mysql-test/t/table_elim.test
+++ b/mysql-test/t/table_elim.test
@@ -249,3 +249,30 @@ select * from t1;
select * from t2;
drop table t1, t2;
+--echo #
+--echo # Tests with various edge-case ON expressions
+--echo #
+create table t1 (a int, b int, c int, d int);
+insert into t1 values (0,0,0,0),(1,1,1,1),(2,2,2,2),(3,3,3,3);
+
+create table t2 (pk int primary key, b int)
+ as select a as pk, a as b from t1 where a in (1,2);
+
+create table t3 (pk1 int, pk2 int, b int, unique(pk1,pk2));
+insert into t3 select a as pk1, a as pk2, a as b from t1 where a in (1,3);
+
+explain select t1.a from t1 left join t2 on t2.pk=t1.a and t2.b<t1.b;
+explain select t1.a from t1 left join t2 on t2.pk=t1.a or t2.b<t1.b;
+explain select t1.a from t1 left join t2 on t2.b<t1.b or t2.pk=t1.a;
+
+explain select t1.a from t1 left join t2 on t2.pk between 10 and 20;
+explain select t1.a from t1 left join t2 on t2.pk between 0.5 and 1.5;
+explain select t1.a from t1 left join t2 on t2.pk between 10 and 10;
+
+explain select t1.a from t1 left join t2 on t2.pk in (10);
+explain select t1.a from t1 left join t2 on t2.pk in (t1.a);
+
+explain select t1.a from t1 left join t2 on TRUE;
+
+drop table t1,t2,t3;
+