From d028d986a9a0a53567f1eda29d407a6d73bb8733 Mon Sep 17 00:00:00 2001 From: Sergey Petrunya Date: Mon, 12 Mar 2012 17:41:22 +0400 Subject: BUG#952297: Server crashes on 2nd execution of PS in Field::is_null with semijoin+materialization - The bug would show up - when using PS (so that we get re-execution) - the left_expr of the subquery is a reference to viewname.column_name, so that it crashes when one tries to use it without having called fix_fields for it. - when using SJ-Materialization, which makes use of sj_subq_pred->left_expr expression - The fix is to have setup_conds() fix sj_subq_pred->left_expr for semi-join nests it finds. --- sql/sql_base.cc | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'sql/sql_base.cc') diff --git a/sql/sql_base.cc b/sql/sql_base.cc index 95a149741de..80828b3d554 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -8497,6 +8497,17 @@ int setup_conds(THD *thd, TABLE_LIST *tables, List &leaves, goto err_no_arena; select_lex->cond_count++; } + /* + If it's a semi-join nest, fix its "left expression", as it is used by + the SJ-Materialization + */ + if (embedded->sj_subq_pred) + { + Item **left_expr= &embedded->sj_subq_pred->left_expr; + if (!(*left_expr)->fixed && (*left_expr)->fix_fields(thd, left_expr)) + goto err_no_arena; + } + embedding= embedded->embedding; } while (embedding && -- cgit v1.2.1