mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
Bug #46791: Assertion failed:(table->key_read==0),function unknown
function,file sql_base.cc When uncacheable queries are written to a temp table the optimizer must preserve the original JOIN structure, because it is re-using the JOIN structure to read from the resulting temporary table. This was done only for uncacheable sub-queries. But top level queries can also benefit from this mechanism, specially if they're using index access and need a reset. Fixed by not limiting the saving of JOIN structure to subqueries exclusively. Added a new test file to extend the existing (large) subquery.test.
This commit is contained in:
@ -1474,12 +1474,8 @@ JOIN::optimize()
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
If this join belongs to an uncacheable subquery save
|
||||
the original join
|
||||
*/
|
||||
if (select_lex->uncacheable && !is_top_level_join() &&
|
||||
init_save_join_tab())
|
||||
/* If this join belongs to an uncacheable query save the original join */
|
||||
if (select_lex->uncacheable && init_save_join_tab())
|
||||
DBUG_RETURN(-1); /* purecov: inspected */
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user