mirror of
https://github.com/MariaDB/server.git
synced 2025-08-07 00:04:31 +03:00
func_gconcat.result, func_gconcat.test:
Added a test case for bug #7769. item_sum.h: Fixed bug #7769: a crash for queries with group_concat and having when the query table was empty. The bug was due an unsafe dereferencing. sql/item_sum.h: Fixed bug #7769: a crash for queries with group_concat and having when the query table was empty. The bug was due an unsafe dereferencing. mysql-test/t/func_gconcat.test: Added a test case for bug #7769. mysql-test/r/func_gconcat.result: Added a test case for bug #7769.
This commit is contained in:
@@ -457,3 +457,8 @@ group_concat(distinct b order by b)
|
|||||||
Warnings:
|
Warnings:
|
||||||
Warning 1260 2 line(s) were cut by GROUP_CONCAT()
|
Warning 1260 2 line(s) were cut by GROUP_CONCAT()
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
CREATE TABLE t1 (id int);
|
||||||
|
SELECT GROUP_CONCAT(id) AS gc FROM t1 HAVING gc IS NULL;
|
||||||
|
gc
|
||||||
|
NULL
|
||||||
|
DROP TABLE t1;
|
||||||
|
@@ -277,3 +277,10 @@ select group_concat(b order by b) from t1 group by a;
|
|||||||
select group_concat(distinct b order by b) from t1 group by a;
|
select group_concat(distinct b order by b) from t1 group by a;
|
||||||
|
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
|
||||||
|
#
|
||||||
|
# bug #7769: group_concat returning null is checked in having
|
||||||
|
#
|
||||||
|
CREATE TABLE t1 (id int);
|
||||||
|
SELECT GROUP_CONCAT(id) AS gc FROM t1 HAVING gc IS NULL;
|
||||||
|
DROP TABLE t1;
|
||||||
|
@@ -739,9 +739,10 @@ class Item_func_group_concat : public Item_sum
|
|||||||
String *res;
|
String *res;
|
||||||
char *end_ptr;
|
char *end_ptr;
|
||||||
int error;
|
int error;
|
||||||
res= val_str(&str_value);
|
if (!(res= val_str(&str_value)))
|
||||||
|
return (longlong) 0;
|
||||||
end_ptr= (char*) res->ptr()+ res->length();
|
end_ptr= (char*) res->ptr()+ res->length();
|
||||||
return res ? my_strtoll10(res->ptr(), &end_ptr, &error) : (longlong) 0;
|
return my_strtoll10(res->ptr(), &end_ptr, &error);
|
||||||
}
|
}
|
||||||
String* val_str(String* str);
|
String* val_str(String* str);
|
||||||
Item *copy_or_same(THD* thd);
|
Item *copy_or_same(THD* thd);
|
||||||
|
Reference in New Issue
Block a user