revision-id: eca05167ae1537094f5adbe1657ad4d9c99bce3d (mariadb-10.3.5-142-geca05167ae1) parent(s): 91245909a2f0c89444ecb5af587284f53b7196ee author: Oleksandr Byelkin committer: Oleksandr Byelkin timestamp: 2018-04-12 13:13:18 +0200 message: fix --- sql/opt_subselect.cc | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/sql/opt_subselect.cc b/sql/opt_subselect.cc index a723980ad50..9cefa628498 100644 --- a/sql/opt_subselect.cc +++ b/sql/opt_subselect.cc @@ -3718,9 +3718,17 @@ bool setup_sj_materialization_part1(JOIN_TAB *sjm_tab) sjm->sjm_table_param.bit_fields_as_long= TRUE; SELECT_LEX *subq_select= emb_sj_nest->sj_subq_pred->unit->first_select(); const LEX_CSTRING sj_materialize_name= { STRING_WITH_LEN("sj-materialize") }; - Ref_ptr_array p_items= subq_select->ref_pointer_array; - for (uint i= 0; i < subq_select->item_list.elements; i++) - sjm->sjm_table_cols.push_back(p_items[i], thd->mem_root); + SELECT_LEX *save_current= thd->lex->current_select; + thd->lex->current_select= subq_select; + List_iterator <Item> it(subq_select->item_list); + Item *item= it++; + for (uint i= 0; i < subq_select->item_list.elements; i++, item= it++) + { + if (!item->fixed && item->fix_fields(thd, it.ref())) + DBUG_RETURN(TRUE); + sjm->sjm_table_cols.push_back(*(it.ref()), thd->mem_root); + } + thd->lex->current_select= save_current; sjm->sjm_table_param.field_count= subq_select->item_list.elements; sjm->sjm_table_param.force_not_null_cols= TRUE;