mirror of
https://github.com/MariaDB/server.git
synced 2025-07-27 18:02:13 +03:00
Bug#24630 Subselect query crashes mysqld
The crash happens because second filling of the same I_S table happens in case of subselect with order by. table->sort.io_cache previously allocated in create_sort_index() is deleted during second filling (function get_schema_tables_result). There are two places where I_S table can be filled: JOIN::exec and create_sort_index(). To fix the bug we should check if the table was already filled in one of these places and skip processing of the table in second.
This commit is contained in:
@ -1505,7 +1505,7 @@ JOIN::exec()
|
||||
|
||||
if ((curr_join->select_lex->options & OPTION_SCHEMA_TABLE) &&
|
||||
!thd->lex->describe &&
|
||||
get_schema_tables_result(curr_join))
|
||||
get_schema_tables_result(curr_join, PROCESSED_BY_JOIN_EXEC))
|
||||
{
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
@ -12372,7 +12372,7 @@ create_sort_index(THD *thd, JOIN *join, ORDER *order,
|
||||
/* Fill schema tables with data before filesort if it's necessary */
|
||||
if ((join->select_lex->options & OPTION_SCHEMA_TABLE) &&
|
||||
!thd->lex->describe &&
|
||||
get_schema_tables_result(join))
|
||||
get_schema_tables_result(join, PROCESSED_BY_CREATE_SORT_INDEX))
|
||||
goto err;
|
||||
|
||||
if (table->s->tmp_table)
|
||||
|
Reference in New Issue
Block a user