diff options
author | unknown <Sinisa@sinisa.nasamreza.org> | 2003-04-10 21:05:28 +0300 |
---|---|---|
committer | unknown <Sinisa@sinisa.nasamreza.org> | 2003-04-10 21:05:28 +0300 |
commit | c11f200890dd1e28320a7b7b26f7b3972cf6a786 (patch) | |
tree | 5124388a4487f309bc776ce29a80ffd8b3d94ad1 | |
parent | 9a86ad60afb6079444ebdd37f90b514a5ef64f6e (diff) | |
download | mariadb-git-c11f200890dd1e28320a7b7b26f7b3972cf6a786.tar.gz |
A fix for a crashing bug in EXPLAIN on derived tables with a join.
-rw-r--r-- | mysql-test/r/derived.result | 5 | ||||
-rw-r--r-- | mysql-test/t/derived.test | 1 | ||||
-rw-r--r-- | sql/sql_derived.cc | 5 |
3 files changed, 10 insertions, 1 deletions
diff --git a/mysql-test/r/derived.result b/mysql-test/r/derived.result index e335e316170..bfd4c544131 100644 --- a/mysql-test/r/derived.result +++ b/mysql-test/r/derived.result @@ -105,6 +105,11 @@ a b 1 a 2 b 3 c +explain select * from (select * from t1,t2 where t1.a=t2.a) t1; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY <derived2> system NULL NULL NULL NULL 1 +2 DERIVED t2 system NULL NULL NULL NULL 1 +2 DERIVED t1 ALL NULL NULL NULL NULL 4 Using where 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; diff --git a/mysql-test/t/derived.test b/mysql-test/t/derived.test index 8b8d9e4d1a2..2ce90c93bd9 100644 --- a/mysql-test/t/derived.test +++ b/mysql-test/t/derived.test @@ -41,6 +41,7 @@ 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; +explain select * from (select * from t1,t2 where t1.a=t2.a) t1; drop table t1, t2; create table t1(a int not null, t char(8), index(a)); disable_query_log; diff --git a/sql/sql_derived.cc b/sql/sql_derived.cc index ca761140955..836c1eb048e 100644 --- a/sql/sql_derived.cc +++ b/sql/sql_derived.cc @@ -194,7 +194,10 @@ int mysql_derived(THD *thd, LEX *lex, SELECT_LEX_UNIT *unit, { // to fix a problem in EXPLAIN if (tables) - tables->table_list->table=tables->table; + { + for (TABLE_LIST *cursor= tables; cursor; cursor= cursor->next) + cursor->table_list->table=cursor->table; + } } else unit->exclude_level(); |