summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorunknown <monty@mashka.mysql.fi>2003-01-21 21:28:51 +0200
committerunknown <monty@mashka.mysql.fi>2003-01-21 21:28:51 +0200
commit8823fa22f16acca6e540074fdcd2491183a38707 (patch)
tree746b47095ebdcc9cd407758fe0edc8f9e2495e33 /mysql-test
parent1291f7798dbf2f711c2b7c85e785cf46d942fc8f (diff)
parent5d5b1fee0211ccd8b234f917075af6d82899e9d2 (diff)
downloadmariadb-git-8823fa22f16acca6e540074fdcd2491183a38707.tar.gz
Merge
client/mysql.cc: Auto merged include/mysql.h: Auto merged include/violite.h: Auto merged libmysqld/lib_sql.cc: Auto merged sql/field.cc: Auto merged sql/ha_berkeley.cc: Auto merged sql/ha_innodb.cc: Auto merged sql/item.cc: Auto merged sql/item_cmpfunc.cc: Auto merged sql/item_func.cc: Auto merged sql/item_strfunc.cc: Auto merged sql/item_sum.cc: Auto merged sql/log.cc: Auto merged sql/log_event.cc: Auto merged sql/mf_iocache.cc: Auto merged sql/mysql_priv.h: Auto merged sql/mysqld.cc: Auto merged sql/opt_range.cc: Auto merged sql/set_var.cc: Auto merged sql/slave.cc: Auto merged sql/sql_acl.cc: Auto merged sql/sql_base.cc: Auto merged sql/sql_cache.cc: Auto merged sql/sql_class.cc: Auto merged sql/sql_handler.cc: Auto merged sql/sql_help.cc: Auto merged sql/sql_parse.cc: Auto merged sql/sql_prepare.cc: Auto merged sql/sql_repl.cc: Auto merged sql/sql_select.cc: Auto merged sql/sql_table.cc: Auto merged sql/sql_yacc.yy: Auto merged sql/protocol.cc: SCCS merged
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/r/explain.result3
-rw-r--r--mysql-test/r/join.result13
-rw-r--r--mysql-test/t/explain.test7
-rw-r--r--mysql-test/t/join.test9
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;
#