summaryrefslogtreecommitdiff
path: root/mysql-test/r
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test/r')
-rw-r--r--mysql-test/r/derived.result4
-rw-r--r--mysql-test/r/subselect.result11
-rw-r--r--mysql-test/r/union.result23
3 files changed, 27 insertions, 11 deletions
diff --git a/mysql-test/r/derived.result b/mysql-test/r/derived.result
index 81e2cd03d1a..cdbca9aa2aa 100644
--- a/mysql-test/r/derived.result
+++ b/mysql-test/r/derived.result
@@ -94,11 +94,13 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 3
2 DERIVED t1 ALL NULL NULL NULL NULL 4
3 UNION t1 ALL NULL NULL NULL NULL 4
+-2 UNION RESULT <union2> ALL NULL NULL NULL NULL NULL
explain select * from (select * from t1 union all select * from t1) a;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 8
2 DERIVED t1 ALL NULL NULL NULL NULL 4
3 UNION t1 ALL NULL NULL NULL NULL 4
+-2 UNION RESULT <union2> ALL NULL NULL NULL NULL NULL
CREATE TABLE t2 (a int not null);
insert into t2 values(1);
select * from (select * from t1 where t1.a=(select a from t2 where t2.a=t1.a)) a;
@@ -246,8 +248,10 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY <derived4> ALL NULL NULL NULL NULL 2
4 DERIVED t1 ALL NULL NULL NULL NULL 2
5 UNION t1 ALL NULL NULL NULL NULL 2
+-4 UNION RESULT <union4> ALL NULL NULL NULL NULL NULL
2 DERIVED t1 ALL NULL NULL NULL NULL 2
3 UNION t1 ALL NULL NULL NULL NULL 2
+-2 UNION RESULT <union2> ALL NULL NULL NULL NULL NULL
drop table t1;
CREATE TABLE `t1` (
`N` int(11) unsigned NOT NULL default '0',
diff --git a/mysql-test/r/subselect.result b/mysql-test/r/subselect.result
index a2210fde222..f578c1a6b64 100644
--- a/mysql-test/r/subselect.result
+++ b/mysql-test/r/subselect.result
@@ -16,6 +16,7 @@ explain extended 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
+-1 UNION RESULT <union1> ALL NULL NULL NULL NULL NULL
Warnings:
Note 1249 Select 2 was reduced during optimisation
Note 1249 Select 4 was reduced during optimisation
@@ -28,6 +29,7 @@ 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 SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used
4 UNION NULL NULL NULL NULL NULL NULL NULL No tables used
+-3 UNION RESULT <union3> ALL NULL NULL NULL NULL NULL
Warnings:
Note 1249 Select 2 was reduced during optimisation
Note 1003 select high_priority (select 0 AS `0` union select 0 AS `0`) AS `(SELECT (SELECT 0 UNION SELECT 0))`
@@ -182,6 +184,7 @@ id select_type table type possible_keys key key_len ref rows Extra
2 SUBQUERY t3 ALL NULL NULL NULL NULL 3 Using filesort
3 UNION t4 ALL NULL NULL NULL NULL 3 Using where; Using filesort
4 SUBQUERY t2 ALL NULL NULL NULL NULL 2
+-1 UNION RESULT <union1> ALL NULL NULL NULL NULL NULL
Warnings:
Note 1003 (select high_priority test.t2.a AS `a`,test.t2.b AS `b` from test.t2 where (test.t2.b = (select test.t3.a AS `a` from test.t3 order by test.t3.a desc limit 1))) union (select test.t4.a AS `a`,test.t4.b AS `b` from test.t4 where (test.t4.b = (select (max(test.t2.a) * 4) AS `max(t2.a)*4` from test.t2)) order by test.t4.a)
select (select a from t3 where a<t2.a*4 order by 1 desc limit 1), a from t2;
@@ -306,6 +309,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t2 ALL NULL NULL NULL NULL 2
2 DEPENDENT SUBQUERY t1 system NULL NULL NULL NULL 1
3 DEPENDENT UNION t5 ALL NULL NULL NULL NULL 2 Using where
+-2 UNION RESULT <union2> ALL NULL NULL NULL NULL NULL
Warnings:
Note 1276 Field or reference 't2.a' of SELECT #2 was resolved in SELECT #1
Note 1276 Field or reference 't2.a' of SELECT #3 was resolved in SELECT #1
@@ -413,6 +417,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 index NULL topic 3 NULL 2 Using index
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used
3 UNION NULL NULL NULL NULL NULL NULL NULL No tables used
+-2 UNION RESULT <union2> ALL NULL NULL NULL NULL NULL
Warnings:
Note 1003 select high_priority 1 AS `1` from test.t1
drop table t1;
@@ -727,6 +732,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t2 index NULL id 5 NULL 2 Using where; Using index
2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used
3 DEPENDENT UNION NULL NULL NULL NULL NULL NULL NULL No tables used
+-2 UNION RESULT <union2> ALL NULL NULL NULL NULL NULL
Warnings:
Note 1003 select high_priority test.t2.id AS `id` from test.t2 where <in_optimizer>(test.t2.id,<exists>(select 1 AS `Not_used` having (<cache>(test.t2.id) = <null_helper>(1)) union select 1 AS `Not_used` having (<cache>(test.t2.id) = <null_helper>(3))))
SELECT * FROM t2 WHERE id IN (SELECT 5 UNION SELECT 3);
@@ -1536,11 +1542,14 @@ e
select * from t1 where 'f' > any (select s1 from t1 union select s1 from t1);
s1
e
-explain select * from t1 where 'f' > any (select s1 from t1 union select s1 from t1);
+explain extended select * from t1 where 'f' > any (select s1 from t1 union select s1 from t1);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 system NULL NULL NULL NULL 1
2 SUBQUERY t1 system NULL NULL NULL NULL 1
3 UNION t1 system NULL NULL NULL NULL 1
+-2 UNION RESULT <union2> ALL NULL NULL NULL NULL NULL
+Warnings:
+Note 1003 select high_priority test.t1.s1 AS `s1` from test.t1
drop table t1;
CREATE TABLE t1 (number char(11) NOT NULL default '') ENGINE=MyISAM CHARSET=latin1;
INSERT INTO t1 VALUES ('69294728265'),('18621828126'),('89356874041'),('95895001874');
diff --git a/mysql-test/r/union.result b/mysql-test/r/union.result
index bf8b8df7c65..d14c4408946 100644
--- a/mysql-test/r/union.result
+++ b/mysql-test/r/union.result
@@ -86,6 +86,7 @@ explain extended (select a,b from t1 limit 2) union all (select a,b from t2 ord
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 4
2 UNION t2 ALL NULL NULL NULL NULL 4 Using filesort
+-1 UNION RESULT <union1> ALL NULL NULL NULL NULL NULL Using filesort
Warnings:
Note 1003 (select high_priority test.t1.a AS `a`,test.t1.b AS `b` from test.t1 limit 2) union all (select test.t2.a AS `a`,test.t2.b AS `b` from test.t2 order by test.t2.a limit 1) order by b desc
(select sql_calc_found_rows a,b from t1 limit 2) union all (select a,b from t2 order by a) limit 2;
@@ -106,21 +107,15 @@ explain select a,b from t1 union all select a,b from t2;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 4
2 UNION t2 ALL NULL NULL NULL NULL 4
+-1 UNION RESULT <union1> ALL NULL NULL NULL NULL NULL
explain select xx from t1 union select 1;
ERROR 42S22: Unknown column 'xx' in 'field list'
explain select a,b from t1 union select 1;
-id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t1 ALL NULL NULL NULL NULL 4
-2 UNION NULL NULL NULL NULL NULL NULL NULL No tables used
+ERROR 21000: The used SELECT statements have a different number of columns
explain select 1 union select a,b from t1 union select 1;
-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
-2 UNION t1 ALL NULL NULL NULL NULL 4
-3 UNION NULL NULL NULL NULL NULL NULL NULL No tables used
+ERROR 21000: The used SELECT statements have a different number of columns
explain select a,b from t1 union select 1 limit 0;
-id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
-2 UNION NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
+ERROR 21000: The used SELECT statements have a different number of columns
select a,b from t1 into outfile 'skr' union select a,b from t2;
ERROR HY000: Wrong usage of UNION and INTO
select a,b from t1 order by a union select a,b from t2;
@@ -475,6 +470,7 @@ explain extended (select * from t1 where a=1) union (select * from t2 where a=1)
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 const PRIMARY PRIMARY 4 const 1
2 UNION t2 const PRIMARY PRIMARY 4 const 1
+-1 UNION RESULT <union1> ALL NULL NULL NULL NULL NULL
Warnings:
Note 1003 (select high_priority test.t1.a AS `a`,test.t1.b AS `b` from test.t1 where (test.t1.a = 1)) union (select test.t2.a AS `a`,test.t2.b AS `b` from test.t2 where (test.t2.a = 1))
(select * from t1 where a=5) union (select * from t2 where a=1);
@@ -497,10 +493,12 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
2 UNION t1 index PRIMARY PRIMARY 4 NULL 4 Using index
2 UNION t2 index PRIMARY PRIMARY 4 NULL 3 Using where; Using index
+-1 UNION RESULT <union1> ALL NULL NULL NULL NULL NULL
explain (select * from t1 where a=1) union (select * from t1 where b=1);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 const PRIMARY PRIMARY 4 const 1
2 UNION t1 ref b b 5 const 1 Using where
+-1 UNION RESULT <union1> ALL NULL NULL NULL NULL NULL
drop table t1,t2;
create table t1 ( id int not null auto_increment, primary key (id) ,user_name text );
create table t2 ( id int not null auto_increment, primary key (id) ,group_name text );
@@ -950,3 +948,8 @@ a
1
drop table t1, t2;
set sql_select_limit=default;
+CREATE TABLE t1 (i int(11) default NULL,c char(1) default NULL,KEY i (i));
+CREATE TABLE t2 (i int(11) default NULL,c char(1) default NULL,KEY i (i));
+explain (select * from t1) union (select * from t2) order by not_existing_column;
+ERROR 42S22: Unknown column 'not_existing_column' in 'order clause'
+drop table t1, t2;