Commit 2b475b56 authored by Sergei Petrunia's avatar Sergei Petrunia

MDEV-7927: Server crashes in in Time_and_counter_tracker::incr_loops

- JOIN::save_explain_data should also set JOIN::tracker (it already
  sets join_tab[0].tracker). This is needed for UNIONs inside subqueries.
parent 0df8c0aa
......@@ -894,3 +894,15 @@ EXPLAIN
}
}
DROP TABLE t1, t2;
#
# MDEV-7927: Server crashes in in Time_and_counter_tracker::incr_loops
#
CREATE TABLE t1 (i INT);
INSERT INTO t1 VALUES (1),(2);
EXPLAIN SELECT * FROM t1 WHERE 3 IN ( SELECT 4 UNION SELECT 5 );
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used
3 UNION NULL NULL NULL NULL NULL NULL NULL No tables used
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL
DROP TABLE t1;
......@@ -200,3 +200,11 @@ INSERT INTO t2 VALUES (3),(4);
EXPLAIN FORMAT=JSON SELECT * FROM t1 WHERE a <> ALL ( SELECT b FROM t2 );
DROP TABLE t1, t2;
--echo #
--echo # MDEV-7927: Server crashes in in Time_and_counter_tracker::incr_loops
--echo #
CREATE TABLE t1 (i INT);
INSERT INTO t1 VALUES (1),(2);
EXPLAIN SELECT * FROM t1 WHERE 3 IN ( SELECT 4 UNION SELECT 5 );
DROP TABLE t1;
......@@ -2376,8 +2376,10 @@ void JOIN::save_explain_data(Explain_query *output, bool can_overwrite,
This is fake_select_lex. It has no query plan, but we need to set up a
tracker for ANALYZE
*/
Explain_union *eu= output->get_union(select_lex->master_unit()->first_select()->select_number);
uint nr= select_lex->master_unit()->first_select()->select_number;
Explain_union *eu= output->get_union(nr);
join_tab[0].tracker= eu->get_fake_select_lex_tracker();
tracker= &eu->time_tracker;
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment