diff options
Diffstat (limited to 'sql/item_subselect.cc')
-rw-r--r-- | sql/item_subselect.cc | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc index 9e6c205ca76..e614421030a 100644 --- a/sql/item_subselect.cc +++ b/sql/item_subselect.cc @@ -407,11 +407,11 @@ bool Item_subselect::mark_as_dependent(THD *thd, st_select_lex *select, { is_correlated= TRUE; Ref_to_outside *upper; - if (!(upper= new (thd->stmt_arena->mem_root) Ref_to_outside())) + if (!(upper= new (thd->mem_root) Ref_to_outside())) return TRUE; upper->select= select; upper->item= item; - if (upper_refs.push_back(upper, thd->stmt_arena->mem_root)) + if (upper_refs.push_back(upper, thd->mem_root)) return TRUE; } return FALSE; @@ -2117,7 +2117,7 @@ Item_in_subselect::single_value_transformer(JOIN *join) thd->lex->current_select= current; /* We will refer to upper level cache array => we have to save it for SP */ - optimizer->keep_top_level_cache(); + DBUG_ASSERT(optimizer->get_cache()[0]->is_array_kept()); /* As far as Item_in_optimizer does not substitute itself on fix_fields @@ -2517,7 +2517,7 @@ Item_in_subselect::row_value_transformer(JOIN *join) } // we will refer to upper level cache array => we have to save it in PS - optimizer->keep_top_level_cache(); + DBUG_ASSERT(optimizer->get_cache()[0]->is_array_kept()); thd->lex->current_select= current; /* @@ -4680,6 +4680,12 @@ void subselect_uniquesubquery_engine::print(String *str, { str->append(STRING_WITH_LEN("<primary_index_lookup>(")); tab->ref.items[0]->print(str, query_type); + if (!tab->table) + { + // table is not opened so unknown + str->append(')'); + return; + } str->append(STRING_WITH_LEN(" in ")); if (tab->table->s->table_category == TABLE_CATEGORY_TEMPORARY) { @@ -5268,7 +5274,7 @@ bool subselect_hash_sj_engine::init(List<Item> *tmp_columns, uint subquery_id) //fprintf(stderr, "Q: %s\n", current_thd->query()); DBUG_ASSERT(0); DBUG_ASSERT( - tmp_table->s->uniques || + (tmp_table->key_info->flags & HA_UNIQUE_HASH) || tmp_table->key_info->key_length >= tmp_table->file->max_key_length() || tmp_table->key_info->user_defined_key_parts > tmp_table->file->max_key_parts()); |