mirror of
https://github.com/MariaDB/server.git
synced 2025-12-24 11:21:21 +03:00
fixed deleting derived table tree after using (BUG#1536)
mysql-test/r/subselect.result: fixed drop table statement test for BUG#1536 mysql-test/t/subselect.test: fixed drop table statement test for BUG#1536 sql/sql_derived.cc: all tree of derived table should be deleted sql/sql_lex.cc: delete subtree method sql/sql_lex.h: delete subtree method
This commit is contained in:
@@ -1438,4 +1438,11 @@ explain select * from t3 where a > all (select max(b) from t2 group by a);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 Using where
|
||||
2 SUBQUERY t2 ALL NULL NULL NULL NULL 4 Using temporary; Using filesort
|
||||
drop table if exists t2, t3;
|
||||
drop table t2, t3;
|
||||
create table t1 (E1 INTEGER UNSIGNED NOT NULL, E2 INTEGER UNSIGNED NOT NULL, E3 INTEGER UNSIGNED NOT NULL, PRIMARY KEY(E1)
|
||||
);
|
||||
insert into t1 VALUES(1,1,1), (2,2,1);
|
||||
select count(*) from t1 INNER JOIN (SELECT A.E1, A.E2, A.E3 FROM t1 AS A WHERE A.E3 = (SELECT MAX(B.E3) FROM t1 AS B WHERE A.E2 = B.E2)) AS THEMAX ON t1.E1 = THEMAX.E2 AND t1.E1 = t1.E2;
|
||||
count(*)
|
||||
2
|
||||
drop table t1;
|
||||
|
||||
@@ -964,4 +964,13 @@ explain select * from t3 where a >= all (select b from t2);
|
||||
insert into t2 values (2,2), (2,1), (3,3), (3,1);
|
||||
select * from t3 where a > all (select max(b) from t2 group by a);
|
||||
explain select * from t3 where a > all (select max(b) from t2 group by a);
|
||||
drop table if exists t2, t3;
|
||||
drop table t2, t3;
|
||||
|
||||
#
|
||||
# deived tables with subquery inside all by one table
|
||||
#
|
||||
create table t1 (E1 INTEGER UNSIGNED NOT NULL, E2 INTEGER UNSIGNED NOT NULL, E3 INTEGER UNSIGNED NOT NULL, PRIMARY KEY(E1)
|
||||
);
|
||||
insert into t1 VALUES(1,1,1), (2,2,1);
|
||||
select count(*) from t1 INNER JOIN (SELECT A.E1, A.E2, A.E3 FROM t1 AS A WHERE A.E3 = (SELECT MAX(B.E3) FROM t1 AS B WHERE A.E2 = B.E2)) AS THEMAX ON t1.E1 = THEMAX.E2 AND t1.E1 = t1.E2;
|
||||
drop table t1;
|
||||
|
||||
Reference in New Issue
Block a user