#At lp:maria based on revid:monty@askmonty.org-20100408115657-lxjm4cpvi4zp81rk 2845 Igor Babaev 2010-04-08 Fixed a problem of merge from mysql-5.1 baseline. modified: sql/sql_select.cc === modified file 'sql/sql_select.cc' --- a/sql/sql_select.cc 2010-03-10 09:12:23 +0000 +++ b/sql/sql_select.cc 2010-04-08 20:55:17 +0000 @@ -2335,7 +2335,13 @@ JOIN::destroy() tab->cleanup(); } tmp_join->tmp_join= 0; + /* + We need to clean up tmp_table_param for reusable JOINs (having non-zero + and different from self tmp_join) because it's not being cleaned up + anywhere else (as we need to keep the join is reusable). + */ tmp_table_param.cleanup(); + tmp_join->tmp_table_param.copy_field= 0; DBUG_RETURN(tmp_join->destroy()); } cond_equal= 0;