summaryrefslogtreecommitdiff
path: root/sql/sql_base.cc
diff options
context:
space:
mode:
authorSergey Petrunya <psergey@askmonty.org>2012-03-12 17:41:22 +0400
committerSergey Petrunya <psergey@askmonty.org>2012-03-12 17:41:22 +0400
commitd028d986a9a0a53567f1eda29d407a6d73bb8733 (patch)
treed0d775d33caef04cb5a9b811a43968a6a9109882 /sql/sql_base.cc
parent54f9fe6c8b0472f0e12602eabf94ff4d73161806 (diff)
downloadmariadb-git-d028d986a9a0a53567f1eda29d407a6d73bb8733.tar.gz
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.
Diffstat (limited to 'sql/sql_base.cc')
-rw-r--r--sql/sql_base.cc11
1 files changed, 11 insertions, 0 deletions
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<TABLE_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 &&