mirror of
https://github.com/MariaDB/server.git
synced 2025-08-21 16:03:24 +03:00
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.
This commit is contained in:
@@ -787,3 +787,12 @@ DROP TABLE t1;
|
||||
# End of test BUG#13012483
|
||||
#
|
||||
End of 5.1 tests
|
||||
#
|
||||
# LP bug#992380 Crash when creating PS for a query with
|
||||
# subquery in WHERE (see also mysql bug#13012483)
|
||||
#
|
||||
CREATE TABLE t1 (a INT);
|
||||
PREPARE s FROM "SELECT 1 FROM t1 WHERE 1 < ALL (SELECT @:= (1 IN (SELECT 1 FROM t1)) FROM t1)";
|
||||
EXECUTE s;
|
||||
1
|
||||
DROP TABLE t1;
|
||||
|
@@ -576,3 +576,14 @@ DROP TABLE t1;
|
||||
|
||||
--echo #
|
||||
--echo End of 5.1 tests
|
||||
|
||||
--echo #
|
||||
--echo # LP bug#992380 Crash when creating PS for a query with
|
||||
--echo # subquery in WHERE (see also mysql bug#13012483)
|
||||
--echo #
|
||||
CREATE TABLE t1 (a INT);
|
||||
PREPARE s FROM "SELECT 1 FROM t1 WHERE 1 < ALL (SELECT @:= (1 IN (SELECT 1 FROM t1)) FROM t1)";
|
||||
EXECUTE s;
|
||||
|
||||
DROP TABLE t1;
|
||||
|
||||
|
@@ -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;
|
||||
}
|
||||
|
@@ -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();
|
||||
|
@@ -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;
|
||||
|
@@ -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(),
|
||||
|
Reference in New Issue
Block a user