diff options
author | Georgi Kodinov <joro@sun.com> | 2009-09-03 18:03:46 +0300 |
---|---|---|
committer | Georgi Kodinov <joro@sun.com> | 2009-09-03 18:03:46 +0300 |
commit | 629557ff13e28e3422dfa1c354c44ef2fd62e4d0 (patch) | |
tree | 068d0eb56cfb6f3cf3efa8d825b43ac3f5c4f70a /sql | |
parent | 643fbe4234a06e51746c8912223652a3b41fe133 (diff) | |
download | mariadb-git-629557ff13e28e3422dfa1c354c44ef2fd62e4d0.tar.gz |
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.
Diffstat (limited to 'sql')
-rw-r--r-- | sql/sql_select.cc | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/sql/sql_select.cc b/sql/sql_select.cc index b670e6e3637..9d5e67c9532 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -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 */ } |