diff options
Diffstat (limited to 'sql/item_subselect.cc')
-rw-r--r-- | sql/item_subselect.cc | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc index 064744158d1..dbf30d7d793 100644 --- a/sql/item_subselect.cc +++ b/sql/item_subselect.cc @@ -830,6 +830,8 @@ Item_in_subselect::single_value_transformer(JOIN *join, ref_pointer_array, (char *)"<ref>", this->full_name())); + if (!abort_on_null && left_expr->maybe_null) + item= new Item_cond_or(new Item_func_isnull(left_expr), item); /* AND and comparison functions can't be changed during fix_fields() we can assign select_lex->having here, and pass 0 as last @@ -874,6 +876,8 @@ Item_in_subselect::single_value_transformer(JOIN *join, goto err; item= new Item_cond_or(item, new Item_func_isnull(orig_item)); + if (left_expr->maybe_null) + item= new Item_cond_or(new Item_func_isnull(left_expr), item); } item->name= (char *)in_additional_cond; /* @@ -895,12 +899,13 @@ Item_in_subselect::single_value_transformer(JOIN *join, we can assign select_lex->having here, and pass 0 as last argument (reference) to fix_fields() */ - select_lex->having= - join->having= - func->create(expr, + item= func->create(expr, new Item_null_helper(this, item, (char *)"<no matter>", (char *)"<result>")); + if (!abort_on_null && left_expr->maybe_null) + item= new Item_cond_or(new Item_func_isnull(left_expr), item); + select_lex->having= join->having= item; select_lex->having_fix_field= 1; tmp= join->having->fix_fields(thd, join->tables_list, 0); select_lex->having_fix_field= 0; |