diff options
author | Sergey Petrunya <psergey@askmonty.org> | 2009-08-27 01:01:40 +0400 |
---|---|---|
committer | Sergey Petrunya <psergey@askmonty.org> | 2009-08-27 01:01:40 +0400 |
commit | 005c24e9739f1050e846cef8a3e75c4671b30a7b (patch) | |
tree | 4e02da9cddc2463588ee0a2efda46fe10082a52a /mysql-test/t/table_elim.test | |
parent | c483437781d04bd1bffbc6de5070b2032a6ae00f (diff) | |
download | mariadb-git-005c24e9739f1050e846cef8a3e75c4671b30a7b.tar.gz |
MWL#17: Table elimination:
- Fix a trivial problem when OR-merging two multi-equalities
- Amend testsuite to provide full gcov coverage
mysql-test/r/table_elim.result:
MWL#17: Table elimination:
- Amend testsuite to provide full gcov coverage
mysql-test/t/table_elim.test:
MWL#17: Table elimination:
- Amend testsuite to provide full gcov coverage
Diffstat (limited to 'mysql-test/t/table_elim.test')
-rw-r--r-- | mysql-test/t/table_elim.test | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/mysql-test/t/table_elim.test b/mysql-test/t/table_elim.test index cab90cb5286..642c5d51d62 100644 --- a/mysql-test/t/table_elim.test +++ b/mysql-test/t/table_elim.test @@ -278,3 +278,61 @@ explain select t1.a from t1 left join t3 on t3.pk1=t1.a and t3.pk2 IS NULL; drop table t1,t2,t3; +--echo # +--echo # Multi-equality tests +--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, c int); +insert into t2 select a,a,a from t1 where a in (1,2); + +explain +select t1.* +from t1 left join t2 on t2.pk=t2.c and t2.b=t1.a and t1.a=t1.b and t2.c=t2.b +where t1.d=1; + +explain +select t1.* +from + t1 + left join + t2 + on (t2.pk=t2.c and t2.b=t1.a and t1.a=t1.b and t2.c=t2.b) or + (t2.pk=t2.c and t2.b=t1.a and t1.a=t1.b and t2.c=t2.b) +where t1.d=1; + +--echo #This can't be eliminated: +explain +select t1.* +from + t1 + left join + t2 + on (t2.pk=t2.c and t2.b=t1.a and t2.c=t1.b) or + (t2.pk=t2.c and t1.a=t1.b and t2.c=t1.b) +where t1.d=1; + +explain +select t1.* +from + t1 + left join + t2 + on (t2.pk=t2.c and t2.b=t1.a and t2.c=t1.b) or + (t2.pk=t2.c and t2.c=t1.b) +; + +explain +select t1.* +from t1 left join t2 on t2.pk=3 or t2.pk= 4; + +explain +select t1.* +from t1 left join t2 on t2.pk=3 or t2.pk= 3; + +explain +select t1.* +from t1 left join t2 on (t2.pk=3 and t2.b=3) or (t2.pk= 4 and t2.b=3); + +drop table t1, t2; |