summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorunknown <bell@sanja.is.com.ua>2002-12-31 12:55:03 +0200
committerunknown <bell@sanja.is.com.ua>2002-12-31 12:55:03 +0200
commit53894481bfd2e7e1cf2a30706fd99ec67656dd5e (patch)
tree9f351bd5a522793ebcd27a5acad3f1a97a9fa939 /mysql-test
parenta83a0d4b328b916cffaf8165fd3d9e377ec1a8f3 (diff)
parent3ab0ddc294891f31b65f92fb7af265047db15d52 (diff)
downloadmariadb-git-53894481bfd2e7e1cf2a30706fd99ec67656dd5e.tar.gz
merging
mysql-test/r/subselect.result: Auto merged sql/item.cc: Auto merged sql/mysql_priv.h: Auto merged sql/sql_base.cc: Auto merged sql/sql_derived.cc: Auto merged sql/sql_lex.cc: Auto merged sql/sql_select.cc: Auto merged sql/sql_show.cc: Auto merged sql/sql_table.cc: Auto merged
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/r/subselect.result33
-rw-r--r--mysql-test/t/subselect.test9
2 files changed, 40 insertions, 2 deletions
diff --git a/mysql-test/r/subselect.result b/mysql-test/r/subselect.result
index 7d4de715bc2..7059054104f 100644
--- a/mysql-test/r/subselect.result
+++ b/mysql-test/r/subselect.result
@@ -1,13 +1,32 @@
select (select 2);
(select 2)
2
+explain select (select 2);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used
+Warnings:
+Note 1247 Select 2 was reduced during optimisation
SELECT (SELECT 1) UNION SELECT (SELECT 2);
(SELECT 1)
1
2
+explain SELECT (SELECT 1) UNION SELECT (SELECT 2);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used
+3 UNION NULL NULL NULL NULL NULL NULL NULL No tables used
+Warnings:
+Note 1247 Select 2 was reduced during optimisation
+Note 1247 Select 4 was reduced during optimisation
SELECT (SELECT (SELECT 0 UNION SELECT 0));
(SELECT (SELECT 0 UNION SELECT 0))
0
+explain SELECT (SELECT (SELECT 0 UNION SELECT 0));
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used
+3 SUBSELECT NULL NULL NULL NULL NULL NULL NULL No tables used
+4 UNION NULL NULL NULL NULL NULL NULL NULL No tables used
+Warnings:
+Note 1247 Select 2 was reduced during optimisation
SELECT (SELECT 1 FROM (SELECT 1) as b HAVING a=1) as a;
Reference 'a' not supported (forward reference in item list)
SELECT (SELECT 1 FROM (SELECT 1) as b HAVING b=1) as a,(SELECT 1 FROM (SELECT 1) as c HAVING a=1) as b;
@@ -20,8 +39,9 @@ Reference 'a' not supported (forward reference in item list)
EXPLAIN SELECT 1 FROM (SELECT 1 as a) as b HAVING (SELECT a)=1;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY <derived2> system NULL NULL NULL NULL 1
-3 DEPENDENT SUBSELECT NULL NULL NULL NULL NULL NULL NULL No tables used
2 DERIVED NULL NULL NULL NULL NULL NULL NULL No tables used
+Warnings:
+Note 1247 Select 3 was reduced during optimisation
SELECT 1 FROM (SELECT 1 as a) as b HAVING (SELECT a)=1;
1
1
@@ -629,6 +649,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t ref id id 5 const 1 Using where; Using index
3 SUBSELECT NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
+Note 1247 Select 3 was reduced during optimisation
Note 1247 Select 2 was reduced during optimisation
EXPLAIN SELECT * FROM t WHERE id IN (SELECT 1 UNION SELECT 3);
id select_type table type possible_keys key key_len ref rows Extra
@@ -752,6 +773,16 @@ NULL
select 10.5 > ANY (SELECT * from t);
10.5 > ANY (SELECT * from t)
1
+explain select (select a+1) from t;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t ALL NULL NULL NULL NULL 3
+Warnings:
+Note 1247 Select 2 was reduced during optimisation
+select (select a+1) from t;
+(select a+1)
+2.5
+NULL
+4.5
drop table t;
create table t (a float);
select 10.5 IN (SELECT * from t LIMIT 1);
diff --git a/mysql-test/t/subselect.test b/mysql-test/t/subselect.test
index 92528e5acb4..ba9491125a4 100644
--- a/mysql-test/t/subselect.test
+++ b/mysql-test/t/subselect.test
@@ -1,6 +1,9 @@
select (select 2);
+explain select (select 2);
SELECT (SELECT 1) UNION SELECT (SELECT 2);
+explain SELECT (SELECT 1) UNION SELECT (SELECT 2);
SELECT (SELECT (SELECT 0 UNION SELECT 0));
+explain SELECT (SELECT (SELECT 0 UNION SELECT 0));
-- error 1245
SELECT (SELECT 1 FROM (SELECT 1) as b HAVING a=1) as a;
-- error 1245
@@ -424,6 +427,8 @@ select 1.5 > ALL (SELECT * from t);
select 10.5 > ALL (SELECT * from t);
select 1.5 > ANY (SELECT * from t);
select 10.5 > ANY (SELECT * from t);
+explain select (select a+1) from t;
+select (select a+1) from t;
drop table t;
#LIMIT is not supported now
@@ -432,7 +437,9 @@ create table t (a float);
select 10.5 IN (SELECT * from t LIMIT 1);
-- error 1235
select 10.5 IN (SELECT * from t LIMIT 1 UNION SELECT 1.5);
-drop table t;create table t1 (a int, b int, c varchar(10));
+drop table t;
+
+create table t1 (a int, b int, c varchar(10));
create table t2 (a int);
insert into t1 values (1,2,'a'),(2,3,'b'),(3,4,'c');
insert into t2 values (1),(2),(NULL);