You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Bug#21753180: handle_fatal_signal (sig=11) in my_strtod_int
This problem occurs on a query on a table with this definition:
CREATE TABLE t1(a int, b blob, c blob);
INSERT INTO t1 VALUES(1,2,1),(2,4,1);
The query is:
SELECT a, (SELECT SUM(a + c) FROM (SELECT b as c FROM t1) AS v1) FROM t1;
We see there is an implicit grouping because of the SUM expression.
When analyzing the SUM expression, the aggregation query block should be
calculated as the inner-most query block that the individual columns are
resolved from. "a" refers to t1, so it may be aggregated in the outer
query block. "c" refers to v1, so it must be aggregated in the inner
query block. Thus, the SUM expression should be aggregated in the inner
query block, and the outer query block should be non-aggregated.
However, Item_field::fix_fields() does not calculate this correctly.
The "c" field will be wrapped in an Item_direct_view_ref object and the
condition in this statement will be true (line 5943).
if (from_field == view_ref_found)
return false;
It is correct that we shall not call set_field() for such items, but
missing the calculation of in_sum_func->max_arg_level further down
means that the aggregation level for the SUM expression is calculated
to be the outer query block. Somehow, this causes the failure reported
in the bug. This problem goes away when calculating max_arg_level
also for fields that are resolved from views and derived tables.
Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1
3217
+
Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,(/* select#2 */ select sum((`test`.`t1`.`a` + `test`.`t1`.`b`)) from `test`.`t1`) AS `(SELECT SUM(a + c) FROM (SELECT b as c FROM t1) AS v1)` from `test`.`t1`
3218
+
SELECT a, (SELECT SUM(a + c) FROM (SELECT b as c FROM t1) AS v1) FROM t1;
3219
+
a (SELECT SUM(a + c) FROM (SELECT b as c FROM t1) AS v1)
0 commit comments