mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
MDEV-26249: Crash in Explain_node::print_explain_for_children with slow query log
The problem affected queries in form: SELECT FROM (SELECT where Split Materialized is applicable) WHERE 1=0 The problem was caused by this: - The select in derived table uses two-phase optimization (due to a possible Split Materialized). - The primary select has "Impossible where" and so it short-cuts its optimization. - The optimization for the SELECT in the derived table is never finished, and EXPLAIN data structure has a dangling pointer to select #2. Fixed with this: make JOIN::optimize_stage2() invoke optimization of derived tables when it is handing a degenerate JOIN with zero tables. We will not execute the derived tables but we need their query plans for [SHOW]EXPLAIN.
This commit is contained in:
@ -2732,6 +2732,14 @@ setup_subq_exit:
|
||||
}
|
||||
if (make_aggr_tables_info())
|
||||
DBUG_RETURN(1);
|
||||
|
||||
/*
|
||||
It could be that we've only done optimization stage 1 for
|
||||
some of the derived tables, and never did stage 2.
|
||||
Do it now, otherwise Explain data structure will not be complete.
|
||||
*/
|
||||
if (select_lex->handle_derived(thd->lex, DT_OPTIMIZE))
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
/*
|
||||
Even with zero matching rows, subqueries in the HAVING clause may
|
||||
|
Reference in New Issue
Block a user