diff options
author | Sergey Petrunya <psergey@askmonty.org> | 2012-05-15 15:56:50 +0400 |
---|---|---|
committer | Sergey Petrunya <psergey@askmonty.org> | 2012-05-15 15:56:50 +0400 |
commit | 382e81ca84a51fded86df6f21e0b4e003fc94388 (patch) | |
tree | af14aab326d999ad483dabb1594e3d5ec0e341e6 /mysql-test/t/show_explain.test | |
parent | b3841ae9e4754e2aae1c106767d4ba50236cbf9b (diff) | |
download | mariadb-git-382e81ca84a51fded86df6f21e0b4e003fc94388.tar.gz |
MDEV-270: SHOW EXPLAIN: server crashes in JOIN::print_explain on a query with
select tables optimized away
- Take into account, that for some degenerate joins instead of "join->table_count=0"
the code sets "join->tables_list=0".
Diffstat (limited to 'mysql-test/t/show_explain.test')
-rw-r--r-- | mysql-test/t/show_explain.test | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/mysql-test/t/show_explain.test b/mysql-test/t/show_explain.test index c9f715bbb67..d813956a1fe 100644 --- a/mysql-test/t/show_explain.test +++ b/mysql-test/t/show_explain.test @@ -414,6 +414,40 @@ reap; set debug=''; drop table t3; +--echo # +--echo # MDEV-270: SHOW EXPLAIN: server crashes in JOIN::print_explain on a query with +--echo # select tables optimized away +--echo # + +CREATE TABLE t2 (pk INT PRIMARY KEY, a INT ) ENGINE=MyISAM; +INSERT INTO t2 VALUES + (1,4),(2,62),(3,7),(4,1),(5,0),(6,7),(7,7),(8,1),(9,7),(10,1), + (11,5),(12,2),(13,0),(14,1),(15,8),(16,1),(17,1),(18,9),(19,1),(20,5) ; + +explain SELECT * FROM t2 WHERE a = + (SELECT MAX(a) FROM t2 + WHERE pk= (SELECT MAX(pk) FROM t2 WHERE pk = 3) + ); + +set @show_explain_probe_select_id=2; +set debug='d,show_explain_probe_do_select'; +send SELECT * FROM t2 WHERE a = + (SELECT MAX(a) FROM t2 + WHERE pk= (SELECT MAX(pk) FROM t2 WHERE pk = 3) + ); +connection default; +--source include/wait_condition.inc +evalp show explain for $thr2; +connection con1; +reap; +set debug=''; +drop table t2; + + + + + + ## TODO: Test this: have several SHOW EXPLAIN requests be queued up for a ## thread and served together. |