MDEV-5060 Server crashes on EXPLAIN EXTENDED or EXPLAIN PARTITIONS with explain in slow_log

- If we're running explain with flags, use the same set of flags to make EXPLAIN columns 
  and contents.
This commit is contained in:
Sergey Petrunya 2013-09-25 19:18:02 +04:00
parent ac54df04d8
commit 7d60030c02
3 changed files with 16 additions and 1 deletions

View File

@ -20,3 +20,9 @@ Error 1146 Table 'test.nonexisting' doesn't exist
SELECT 1;
1
1
#
# MDEV-5060 Server crashes on EXPLAIN EXTENDED or EXPLAIN PARTITIONS with explain in slow_log
#
EXPLAIN PARTITIONS SELECT 1 ;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used

View File

@ -28,3 +28,10 @@ SHOW WARNINGS;
--disconnect con1
--connection default
SELECT 1;
--echo #
--echo # MDEV-5060 Server crashes on EXPLAIN EXTENDED or EXPLAIN PARTITIONS with explain in slow_log
--echo #
EXPLAIN PARTITIONS SELECT 1 ;

View File

@ -122,11 +122,13 @@ int QPF_query::print_explain(select_result_sink *output,
}
}
bool print_qpf_query(LEX *lex, THD *thd, String *str)
{
return lex->query_plan_footprint->print_explain_str(thd, str);
}
bool QPF_query::print_explain_str(THD *thd, String *out_str)
{
List<Item> fields;
@ -134,7 +136,7 @@ bool QPF_query::print_explain_str(THD *thd, String *out_str)
select_result_text_buffer output_buf(thd);
output_buf.send_result_set_metadata(fields, thd->lex->describe);
if (print_explain(&output_buf, 0))
if (print_explain(&output_buf, thd->lex->describe))
return true;
output_buf.save_to(out_str);
return false;