diff options
author | monty@mashka.mysql.fi <> | 2003-01-21 21:28:51 +0200 |
---|---|---|
committer | monty@mashka.mysql.fi <> | 2003-01-21 21:28:51 +0200 |
commit | 7436e9ec97feed09bbda0c3a8b58c6f1f30ca243 (patch) | |
tree | 746b47095ebdcc9cd407758fe0edc8f9e2495e33 /mysql-test | |
parent | 49580a5168470a03cf4381b48669a6c821163519 (diff) | |
parent | 4fd9bad4cc03050c1c91b22f5660469ea8b97cca (diff) | |
download | mariadb-git-7436e9ec97feed09bbda0c3a8b58c6f1f30ca243.tar.gz |
Merge
Diffstat (limited to 'mysql-test')
-rw-r--r-- | mysql-test/r/explain.result | 3 | ||||
-rw-r--r-- | mysql-test/r/join.result | 13 | ||||
-rw-r--r-- | mysql-test/t/explain.test | 7 | ||||
-rw-r--r-- | mysql-test/t/join.test | 9 |
4 files changed, 26 insertions, 6 deletions
diff --git a/mysql-test/r/explain.result b/mysql-test/r/explain.result index 2892c2ea587..ff38e9fae7d 100644 --- a/mysql-test/r/explain.result +++ b/mysql-test/r/explain.result @@ -1,5 +1,8 @@ drop table if exists t1; create table t1 (id int not null, str char(10), unique(str)); +explain select * from t1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 system NULL NULL NULL NULL 0 const row not found insert into t1 values (1, null),(2, null),(3, "foo"),(4, "bar"); select * from t1 where str is null; id str diff --git a/mysql-test/r/join.result b/mysql-test/r/join.result index 96113dcdc8b..6649c480d7b 100644 --- a/mysql-test/r/join.result +++ b/mysql-test/r/join.result @@ -14,8 +14,7 @@ insert into t1 values (101); insert into t1 values (105); insert into t1 values (106); insert into t1 values (107); -insert into t2 values (107); -insert into t2 values (75); +insert into t2 values (107),(75),(1000); select t1.id, t2.id from t1, t2 where t2.id = t1.id; id id 107 107 @@ -28,6 +27,16 @@ select t1.id, count(t2.id) from t1,t2 where t2.id = t1.id group by t2.id; id count(t2.id) 75 1 107 1 +select t1.id,t2.id from t2 left join t1 on t1.id>=74 and t1.id<=0 where t2.id=75 and t1.id is null; +id id +NULL 75 +explain select t1.id,t2.id from t2 left join t1 on t1.id>=74 and t1.id<=0 where t2.id=75 and t1.id is null; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 const PRIMARY NULL NULL NULL 1 Impossible ON condition +1 SIMPLE t2 ALL NULL NULL NULL NULL 3 Using where +explain select t1.id, t2.id from t1, t2 where t2.id = t1.id and t1.id <0 and t1.id > 0; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables drop table t1,t2; CREATE TABLE t1 ( id int(11) NOT NULL auto_increment, diff --git a/mysql-test/t/explain.test b/mysql-test/t/explain.test index 3e33d58215e..1cf8c5e93e1 100644 --- a/mysql-test/t/explain.test +++ b/mysql-test/t/explain.test @@ -5,6 +5,7 @@ drop table if exists t1; --enable_warnings create table t1 (id int not null, str char(10), unique(str)); +explain select * from t1; insert into t1 values (1, null),(2, null),(3, "foo"),(4, "bar"); select * from t1 where str is null; select * from t1 where str="foo"; @@ -14,8 +15,10 @@ explain select * from t1 ignore key (str) where str="foo"; explain select * from t1 use key (str,str) where str="foo"; #The following should give errors -!$1072 explain select * from t1 use key (str,str,foo) where str="foo"; -!$1072 explain select * from t1 ignore key (str,str,foo) where str="foo"; +--error 1072 +explain select * from t1 use key (str,str,foo) where str="foo"; +--error 1072 +explain select * from t1 ignore key (str,str,foo) where str="foo"; drop table t1; explain select 1; diff --git a/mysql-test/t/join.test b/mysql-test/t/join.test index 653b4271fe8..2a3b8488ca0 100644 --- a/mysql-test/t/join.test +++ b/mysql-test/t/join.test @@ -21,13 +21,18 @@ insert into t1 values (105); insert into t1 values (106); insert into t1 values (107); -insert into t2 values (107); -insert into t2 values (75); +insert into t2 values (107),(75),(1000); select t1.id, t2.id from t1, t2 where t2.id = t1.id; select t1.id, count(t2.id) from t1,t2 where t2.id = t1.id group by t1.id; select t1.id, count(t2.id) from t1,t2 where t2.id = t1.id group by t2.id; +# +# Test problems with impossible ON or WHERE +# +select t1.id,t2.id from t2 left join t1 on t1.id>=74 and t1.id<=0 where t2.id=75 and t1.id is null; +explain select t1.id,t2.id from t2 left join t1 on t1.id>=74 and t1.id<=0 where t2.id=75 and t1.id is null; +explain select t1.id, t2.id from t1, t2 where t2.id = t1.id and t1.id <0 and t1.id > 0; drop table t1,t2; # |