diff options
author | unknown <bell@sanja.is.com.ua> | 2003-01-26 21:30:35 +0200 |
---|---|---|
committer | unknown <bell@sanja.is.com.ua> | 2003-01-26 21:30:35 +0200 |
commit | a72ebebf5dace430460ebdd9e96322780fcfe882 (patch) | |
tree | e194c81cba3115272354ebd186e5faa8e278d078 /mysql-test | |
parent | fbd882fca6902e5038bef1d25c1afbfad892d09a (diff) | |
download | mariadb-git-a72ebebf5dace430460ebdd9e96322780fcfe882.tar.gz |
after merge fix of 577 task (SCRUM, pre commit to be able to merge with static tables optimization fix)
fixed derived tables with subselect inside
mysql-test/r/derived.result:
test of subselects inside derived tables
mysql-test/t/derived.test:
test of subselects inside derived tables
mysql-test/t/subselect.test:
subselect test (not finished)
sql/item.cc:
after merge fix
sql/item.h:
after merge fix
sql/item_cmpfunc.h:
after merge fix
sql/item_subselect.cc:
after merge fix
sql/item_sum.h:
after merge fix
sql/mysql_priv.h:
fixed derived tables with subselect inside
sql/sql_class.h:
after merge fix
sql/sql_derived.cc:
fixed derived tables with subselect inside
sql/sql_lex.cc:
fixed derived tables with subselect inside
sql/sql_lex.h:
fixed derived tables with subselect inside
sql/sql_parse.cc:
fixed derived tables with subselect inside
after merge fix
sql/sql_prepare.cc:
after merge fix
sql/sql_select.cc:
after merge fix
fixed derived tables with subselect inside
Diffstat (limited to 'mysql-test')
-rw-r--r-- | mysql-test/r/derived.result | 12 | ||||
-rw-r--r-- | mysql-test/t/derived.test | 6 | ||||
-rw-r--r-- | mysql-test/t/subselect.test | 21 |
3 files changed, 28 insertions, 11 deletions
diff --git a/mysql-test/r/derived.result b/mysql-test/r/derived.result index 4f16e239e15..e1e823350d3 100644 --- a/mysql-test/r/derived.result +++ b/mysql-test/r/derived.result @@ -95,7 +95,17 @@ 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 -drop table if exists t1; +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; +a b +1 a +select * from (select * from t1 where t1.a=(select t2.a from t2 where t2.a=t1.a) union select t1.a, t1.b from t1) a; +a b +1 a +2 b +3 c +drop table t1, t2; create table t1(a int not null, t char(8), index(a)); SELECT * FROM (SELECT * FROM t1) as b ORDER BY a ASC LIMIT 0,20; a t diff --git a/mysql-test/t/derived.test b/mysql-test/t/derived.test index 6d1d825a523..1dbdd6e0ae8 100644 --- a/mysql-test/t/derived.test +++ b/mysql-test/t/derived.test @@ -37,7 +37,11 @@ select * from (select * from t1 union select * from t1) a; select * from (select * from t1 union all select * from t1) a; explain select * from (select * from t1 union select * from t1) a; explain select * from (select * from t1 union all select * from t1) a; -drop table if exists t1; +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; +select * from (select * from t1 where t1.a=(select t2.a from t2 where t2.a=t1.a) union select t1.a, t1.b from t1) a; +drop table t1, t2; create table t1(a int not null, t char(8), index(a)); disable_query_log; let $1 = 10000; diff --git a/mysql-test/t/subselect.test b/mysql-test/t/subselect.test index e715cd1d09f..baf58916bd4 100644 --- a/mysql-test/t/subselect.test +++ b/mysql-test/t/subselect.test @@ -206,19 +206,22 @@ SELECT numeropost,maxnumrep FROM t1 WHERE exists (SELECT 1 FROM t2 WHERE (mot='j SELECT (SELECT 1) as a FROM (SELECT 1 FROM t1 HAVING a=1) b; -- error 1054 SELECT 1 IN (SELECT 1 FROM t2 HAVING a); -SELECT * from t2 where topic IN (SELECT topic FROM t2 GROUP BY date); -SELECT * from t2 where topic IN (SELECT topic FROM t2 GROUP BY date HAVING topic < 4100); + +SELECT * from t2 where topic IN (SELECT topic FROM t2 GROUP BY topic); +SELECT * from t2 where topic IN (SELECT topic FROM t2 GROUP BY topic HAVING topic < 4100); SELECT * from t2 where topic IN (SELECT SUM(topic) FROM t1); -SELECT * from t2 where topic = any (SELECT topic FROM t2 GROUP BY date); -SELECT * from t2 where topic = any (SELECT topic FROM t2 GROUP BY date HAVING topic < 4100); +SELECT * from t2 where topic = any (SELECT topic FROM t2 GROUP BY topic); +SELECT * from t2 where topic = any (SELECT topic FROM t2 GROUP BY topic HAVING topic < 4100); SELECT * from t2 where topic = any (SELECT SUM(topic) FROM t1); -SELECT * from t2 where topic = all (SELECT topic FROM t2 GROUP BY date); -SELECT topic FROM t2 GROUP BY date; -SELECT topic FROM t2 GROUP BY date HAVING topic < 4100; -SELECT * from t2 where topic = all (SELECT topic FROM t2 GROUP BY date HAVING topic < 4100); -SELECT *, date as fff from t2 where not (SELECT date FROM t2 GROUP BY date HAVING topic < 4100 and fff!=date); +SELECT * from t2 where topic = all (SELECT topic FROM t2 GROUP BY topic); +SELECT * from t2 where topic = all (SELECT topic FROM t2 GROUP BY topic HAVING topic < 4100); +SELECT topic FROM t2 GROUP BY topic HAVING topic < 4100; +SELECT *, topic = all (SELECT topic FROM t2 GROUP BY topic HAVING topic < 4100) from t2; SELECT * from t2 where topic = all (SELECT SUM(topic) FROM t2); SELECT * from t2 where topic <> any (SELECT SUM(topic) FROM t2); +delete from t2 where topic=40143; +SELECT *, topic = all (SELECT topic FROM t2 GROUP BY topic HAVING topic < 4100) from t2; +SELECT *, topic as fff, exists (SELECT topic FROM t2 GROUP BY topic HAVING topic < 4100 and fff = topic) from t2; drop table t1,t2; #forumconthardwarefr7 |