mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Merge sanja.is.com.ua:/home/bell/mysql/work-row-4.1
into sanja.is.com.ua:/home/bell/mysql/work-from-4.1 sql/item_subselect.cc: Auto merged sql/item_subselect.h: Auto merged
This commit is contained in:
@ -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);
|
||||
|
@ -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
|
||||
@ -433,6 +438,7 @@ 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));
|
||||
create table t2 (a int);
|
||||
insert into t1 values (1,2,'a'),(2,3,'b'),(3,4,'c');
|
||||
|
Reference in New Issue
Block a user