diff options
author | igor@rurik.mysql.com <> | 2006-09-16 09:50:48 -0700 |
---|---|---|
committer | igor@rurik.mysql.com <> | 2006-09-16 09:50:48 -0700 |
commit | d3d3cef88c03025e69f9e3c91a0f72efb0314dc7 (patch) | |
tree | 4c8361af601184f86f978b017dac573e569aba83 /sql/sql_select.cc | |
parent | aa7ae805096b22e9cbf673ffa1fd23d5a823687c (diff) | |
download | mariadb-git-d3d3cef88c03025e69f9e3c91a0f72efb0314dc7.tar.gz |
Fixed bug #21493: crash for the second execution of a function
containing a select statement that uses an aggregating IN subquery.
Added a parameter to the function fix_prepare_information
to restore correctly the having clause for the second execution.
Saved andor structure of the having conditions at the proper moment
before any calls of split_sum_func2 that could modify the having structure
adding new Item_ref objects. (These additions, are produced not with
the statement mem_root, but rather with the execution mem_root.)
Diffstat (limited to 'sql/sql_select.cc')
-rw-r--r-- | sql/sql_select.cc | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 93d923f0669..f4b6bb5c978 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -382,12 +382,14 @@ JOIN::prepare(Item ***rref_pointer_array, if ((res= subselect->select_transformer(this)) != Item_subselect::RES_OK) { - select_lex->fix_prepare_information(thd, &conds); + select_lex->fix_prepare_information(thd, &conds, &having); DBUG_RETURN((res == Item_subselect::RES_ERROR)); } } } + select_lex->fix_prepare_information(thd, &conds, &having); + if (having && having->with_sum_func) having->split_sum_func2(thd, ref_pointer_array, all_fields, &having, TRUE); @@ -499,7 +501,6 @@ JOIN::prepare(Item ***rref_pointer_array, if (alloc_func_list()) goto err; - select_lex->fix_prepare_information(thd, &conds); DBUG_RETURN(0); // All OK err: @@ -618,7 +619,6 @@ JOIN::optimize() build_bitmap_for_nested_joins(join_list, 0); sel->prep_where= conds ? conds->copy_andor_structure(thd) : 0; - sel->prep_having= having ? having->copy_andor_structure(thd) : 0; if (arena) thd->restore_active_arena(arena, &backup); |