diff --git a/sql/opt_subselect.cc b/sql/opt_subselect.cc index ae2c8983623..6f8814468b4 100644 --- a/sql/opt_subselect.cc +++ b/sql/opt_subselect.cc @@ -1227,7 +1227,7 @@ static bool convert_subq_to_sj(JOIN *parent_join, Item_in_subselect *subq_pred) tl->table->tablenr= table_no; tl->table->map= ((table_map)1) << table_no; if (tl->is_jtbm()) - tl->jtbm_table_no= tl->table->map; + tl->jtbm_table_no= tl->table->tablenr; SELECT_LEX *old_sl= tl->select_lex; tl->select_lex= parent_join->select_lex; for (TABLE_LIST *emb= tl->embedding; diff --git a/sql/table.h b/sql/table.h index 35c52f3c473..c38a15df476 100644 --- a/sql/table.h +++ b/sql/table.h @@ -1320,6 +1320,7 @@ struct TABLE_LIST /* If this is a jtbm semi-join object: corresponding subselect predicate */ Item_in_subselect *jtbm_subselect; + /* TODO: check if this can be joined with tablenr_exec */ uint jtbm_table_no; SJ_MATERIALIZATION_INFO *sj_mat_info; @@ -1445,6 +1446,7 @@ struct TABLE_LIST table_map view_used_tables; table_map map_exec; + /* TODO: check if this can be joined with jtbm_table_no */ uint tablenr_exec; /* Ptr to parent MERGE table list item. See top comment in ha_myisammrg.cc */