summaryrefslogtreecommitdiff
path: root/mysql-test/t/table_elim.test
diff options
context:
space:
mode:
authorSergey Petrunya <psergey@askmonty.org>2009-08-17 19:07:24 +0300
committerSergey Petrunya <psergey@askmonty.org>2009-08-17 19:07:24 +0300
commit049c87fc2ef310a0905e12be3007b41e763e0b7a (patch)
tree74c3f9d5add5d1414320316fb6b7f3477608e087 /mysql-test/t/table_elim.test
parent441434e5656c3a6dd46afb309cca12bb4bd87e5e (diff)
downloadmariadb-git-049c87fc2ef310a0905e12be3007b41e763e0b7a.tar.gz
MWL#17: Table elimination
- More testcases
Diffstat (limited to 'mysql-test/t/table_elim.test')
-rw-r--r--mysql-test/t/table_elim.test41
1 files changed, 41 insertions, 0 deletions
diff --git a/mysql-test/t/table_elim.test b/mysql-test/t/table_elim.test
index 8a240e42e9f..6ef9731e212 100644
--- a/mysql-test/t/table_elim.test
+++ b/mysql-test/t/table_elim.test
@@ -175,5 +175,46 @@ select t1.* from t1 left join ( t2 left join t3 on t3.pk=t2.col) on t2.col=t1.co
explain
select t1.*, t2.* from t1 left join (t2 left join t3 on t3.pk=t2.col) on t2.pk=t1.col;
+drop table t1, t2, t3;
+
+--echo #
+--echo # Check things that look like functional dependencies but really are not
+--echo #
+
+create table t1 (a char(10) character set latin1 collate latin1_general_ci primary key);
+insert into t1 values ('foo');
+insert into t1 values ('bar');
+
+create table t2 (a char(10) character set latin1 collate latin1_general_cs primary key);
+insert into t2 values ('foo');
+insert into t2 values ('FOO');
+
+-- echo this must not use table elimination:
+explain select t1.* from t1 left join t2 on t2.a='foo' collate latin1_general_ci;
+
+-- echo this must not use table elimination:
+explain select t1.* from t1 left join t2 on t2.a=t1.a collate latin1_general_ci;
+drop table t1,t2;
+
+create table t1 (a int primary key);
+insert into t1 values (1),(2);
+create table t2 (a char(10) primary key);
+insert into t2 values ('1'),('1.0');
+-- echo this must not use table elimination:
+explain select t1.* from t1 left join t2 on t2.a=1;
+-- echo this must not use table elimination:
+explain select t1.* from t1 left join t2 on t2.a=t1.a;
+
+drop table t1, t2;
+# partial unique keys do not work at the moment, although they are able to
+# provide one-match guarantees:
+create table t1 (a char(10) primary key);
+insert into t1 values ('foo'),('bar');
+
+create table t2 (a char(10), unique key(a(2)));
+insert into t2 values ('foo'),('bar');
+
+explain select t1.* from t1 left join t2 on t2.a=t1.a;
+
drop table t1, t2;