diff options
author | unknown <sanja@montyprogram.com> | 2012-05-22 08:48:10 +0300 |
---|---|---|
committer | unknown <sanja@montyprogram.com> | 2012-05-22 08:48:10 +0300 |
commit | 950abd526837b8772044d521387fa6d410de5706 (patch) | |
tree | d5deadcf46de5a138088ce2f2dd407dbba094a56 /sql | |
parent | 280fcf08085e43b5359ec79c0e34166e51b3ebd8 (diff) | |
download | mariadb-git-950abd526837b8772044d521387fa6d410de5706.tar.gz |
Fix of LP bug#992380 + revise fix_fields about missing with_subselect collection
The problem is that some fix_fields do not call Item_func::fix_fields and do not collect with subselect_information.
Diffstat (limited to 'sql')
-rw-r--r-- | sql/item_cmpfunc.cc | 3 | ||||
-rw-r--r-- | sql/item_func.cc | 1 | ||||
-rw-r--r-- | sql/item_row.cc | 1 | ||||
-rw-r--r-- | sql/item_sum.cc | 3 |
4 files changed, 8 insertions, 0 deletions
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index ea216944dbb..dda9ab418a4 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -1791,6 +1791,7 @@ bool Item_in_optimizer::fix_fields(THD *thd, Item **ref) } if (args[1]->maybe_null) maybe_null=1; + with_subselect= 1; with_sum_func= with_sum_func || args[1]->with_sum_func; used_tables_cache|= args[1]->used_tables(); not_null_tables_cache|= args[1]->not_null_tables(); @@ -4907,6 +4908,7 @@ Item_func_regex::fix_fields(THD *thd, Item **ref) args[1]->fix_fields(thd, args + 1)) || args[1]->check_cols(1)) return TRUE; /* purecov: inspected */ with_sum_func=args[0]->with_sum_func || args[1]->with_sum_func; + with_subselect|= args[0]->with_subselect | args[1]->with_subselect; max_length= 1; decimals= 0; @@ -5597,6 +5599,7 @@ bool Item_equal::fix_fields(THD *thd, Item **ref) used_tables_cache|= item->used_tables(); tmp_table_map= item->not_null_tables(); not_null_tables_cache|= tmp_table_map; + DBUG_ASSERT(!item->with_sum_func && !item->with_subselect); if (item->maybe_null) maybe_null=1; } diff --git a/sql/item_func.cc b/sql/item_func.cc index ed771b60769..8028ae53eaf 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -2918,6 +2918,7 @@ udf_handler::fix_fields(THD *thd, Item_result_field *func, if (item->maybe_null) func->maybe_null=1; func->with_sum_func= func->with_sum_func || item->with_sum_func; + func->with_subselect|= item->with_subselect; used_tables_cache|=item->used_tables(); const_item_cache&=item->const_item(); f_args.arg_type[i]=item->result_type(); diff --git a/sql/item_row.cc b/sql/item_row.cc index 4040dbff7c6..5296f866248 100644 --- a/sql/item_row.cc +++ b/sql/item_row.cc @@ -88,6 +88,7 @@ bool Item_row::fix_fields(THD *thd, Item **ref) } maybe_null|= item->maybe_null; with_sum_func= with_sum_func || item->with_sum_func; + with_subselect|= item->with_subselect; } fixed= 1; return FALSE; diff --git a/sql/item_sum.cc b/sql/item_sum.cc index ac6ddc0fd54..61a780b6222 100644 --- a/sql/item_sum.cc +++ b/sql/item_sum.cc @@ -574,6 +574,7 @@ Item_sum_num::fix_fields(THD *thd, Item **ref) if (args[i]->fix_fields(thd, args + i) || args[i]->check_cols(1)) return TRUE; set_if_bigger(decimals, args[i]->decimals); + with_subselect|= args[i]->with_subselect; } result_field=0; max_length=float_length(decimals); @@ -604,6 +605,7 @@ Item_sum_hybrid::fix_fields(THD *thd, Item **ref) (item= args[0])->check_cols(1)) return TRUE; decimals=item->decimals; + with_subselect= args[0]->with_subselect; switch (hybrid_type= item->result_type()) { case INT_RESULT: @@ -3216,6 +3218,7 @@ Item_func_group_concat::fix_fields(THD *thd, Item **ref) args[i]->fix_fields(thd, args + i)) || args[i]->check_cols(1)) return TRUE; + with_subselect|= args[i]->with_subselect; } if (agg_item_charsets(collation, func_name(), |