diff options
Diffstat (limited to 'sql/item_subselect.cc')
-rw-r--r-- | sql/item_subselect.cc | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc index 48d38c0d602..91a31502780 100644 --- a/sql/item_subselect.cc +++ b/sql/item_subselect.cc @@ -74,6 +74,11 @@ void Item_subselect::init(st_select_lex *select_lex, else engine= new subselect_single_select_engine(select_lex, result, this); } + { + SELECT_LEX *upper= unit->outer_select(); + if (upper->parsing_place == SELECT_LEX_NODE::IN_HAVING) + upper->subquery_in_having= 1; + } DBUG_VOID_RETURN; } @@ -657,7 +662,6 @@ Item_in_subselect::single_value_transformer(JOIN *join, !(select_lex->next_select())) { Item *item; - subs_type type= substype(); if (func->l_op()) { /* @@ -1183,7 +1187,7 @@ int subselect_single_select_engine::exec() join->thd->where= save_where; executed= 1; join->thd->lex->current_select= save_select; - DBUG_RETURN(join->error?join->error:1); + DBUG_RETURN(join->error ? join->error : 1); } if (item->engine_changed) { @@ -1235,6 +1239,8 @@ int subselect_uniquesubquery_engine::exec() } else { + if (!table->file->inited) + table->file->ha_index_init(tab->ref.key); error= table->file->index_read(table->record[0], tab->ref.key_buff, tab->ref.key_length,HA_READ_KEY_EXACT); @@ -1256,7 +1262,7 @@ int subselect_uniquesubquery_engine::exec() subselect_uniquesubquery_engine::~subselect_uniquesubquery_engine() { /* Tell handler we don't need the index anymore */ - tab->table->file->index_end(); + tab->table->file->ha_index_end(); } @@ -1283,6 +1289,8 @@ int subselect_indexsubquery_engine::exec() } else { + if (!table->file->inited) + table->file->ha_index_init(tab->ref.key); error= table->file->index_read(table->record[0], tab->ref.key_buff, tab->ref.key_length,HA_READ_KEY_EXACT); |