mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 12:02:42 +01:00
Bug #20868: Client connection is broken on SQL query error
An aggregate function reference was resolved incorrectly and caused a crash in count_field_types. Must use real_item() to get to the real Item instance through the reference mysql-test/r/func_group.result: Bug #20868: Client connection is broken on SQL query error * test case for the bug mysql-test/t/func_group.test: Bug #20868: Client connection is broken on SQL query error * test case for the bug sql/sql_select.cc: Bug #20868: Client connection is broken on SQL query error * correctly resolve aggregate function references.
This commit is contained in:
parent
c3f0d2f6cb
commit
8024aabb76
3 changed files with 27 additions and 1 deletions
|
@ -988,3 +988,14 @@ SUM(a)
|
|||
6
|
||||
DROP TABLE t1;
|
||||
set div_precision_increment= @sav_dpi;
|
||||
CREATE TABLE t1 (a INT PRIMARY KEY, b INT);
|
||||
INSERT INTO t1 VALUES (1,1), (2,2);
|
||||
CREATE TABLE t2 (a INT PRIMARY KEY, b INT);
|
||||
INSERT INTO t2 VALUES (1,1), (3,3);
|
||||
SELECT SQL_NO_CACHE
|
||||
(SELECT SUM(c.a) FROM t1 ttt, t2 ccc
|
||||
WHERE ttt.a = ccc.b AND ttt.a = t.a GROUP BY ttt.a) AS minid
|
||||
FROM t1 t, t2 c WHERE t.a = c.b;
|
||||
minid
|
||||
NULL
|
||||
DROP TABLE t1,t2;
|
||||
|
|
|
@ -660,3 +660,18 @@ SELECT SUM(a) FROM t1 GROUP BY b/c;
|
|||
DROP TABLE t1;
|
||||
set div_precision_increment= @sav_dpi;
|
||||
|
||||
#
|
||||
# Bug #20868: Client connection is broken on SQL query error
|
||||
#
|
||||
CREATE TABLE t1 (a INT PRIMARY KEY, b INT);
|
||||
INSERT INTO t1 VALUES (1,1), (2,2);
|
||||
|
||||
CREATE TABLE t2 (a INT PRIMARY KEY, b INT);
|
||||
INSERT INTO t2 VALUES (1,1), (3,3);
|
||||
|
||||
SELECT SQL_NO_CACHE
|
||||
(SELECT SUM(c.a) FROM t1 ttt, t2 ccc
|
||||
WHERE ttt.a = ccc.b AND ttt.a = t.a GROUP BY ttt.a) AS minid
|
||||
FROM t1 t, t2 c WHERE t.a = c.b;
|
||||
|
||||
DROP TABLE t1,t2;
|
||||
|
|
|
@ -12806,7 +12806,7 @@ count_field_types(TMP_TABLE_PARAM *param, List<Item> &fields,
|
|||
{
|
||||
if (! field->const_item())
|
||||
{
|
||||
Item_sum *sum_item=(Item_sum*) field;
|
||||
Item_sum *sum_item=(Item_sum*) field->real_item();
|
||||
if (!sum_item->quick_group)
|
||||
param->quick_group=0; // UDF SUM function
|
||||
param->sum_func_count++;
|
||||
|
|
Loading…
Reference in a new issue