summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <monty@mysql.com>2005-01-15 12:00:56 +0200
committerunknown <monty@mysql.com>2005-01-15 12:00:56 +0200
commit193eae3bece02daa473f0e264d235ea3e407a88d (patch)
tree7d10cbc9160a8e857b498ebe2cf30c200bf3d59a
parent403541d7e8af62011422c54d857051a40ccf245c (diff)
parent16f3170e7352b06a8b142bfef89bbcc383c2a676 (diff)
downloadmariadb-git-193eae3bece02daa473f0e264d235ea3e407a88d.tar.gz
Merge bk-internal.mysql.com:/home/bk/mysql-4.1
into mysql.com:/home/my/mysql-4.1
-rw-r--r--mysql-test/r/func_gconcat.result5
-rw-r--r--mysql-test/t/func_gconcat.test7
-rw-r--r--sql/item_sum.h5
3 files changed, 15 insertions, 2 deletions
diff --git a/mysql-test/r/func_gconcat.result b/mysql-test/r/func_gconcat.result
index aa202823c77..390b33fdddc 100644
--- a/mysql-test/r/func_gconcat.result
+++ b/mysql-test/r/func_gconcat.result
@@ -457,3 +457,8 @@ group_concat(distinct b order by b)
Warnings:
Warning 1260 2 line(s) were cut by GROUP_CONCAT()
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;
diff --git a/mysql-test/t/func_gconcat.test b/mysql-test/t/func_gconcat.test
index e0737a42221..6a91a7ac9c7 100644
--- a/mysql-test/t/func_gconcat.test
+++ b/mysql-test/t/func_gconcat.test
@@ -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;
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;
diff --git a/sql/item_sum.h b/sql/item_sum.h
index cec611b8854..d1e82387944 100644
--- a/sql/item_sum.h
+++ b/sql/item_sum.h
@@ -739,9 +739,10 @@ class Item_func_group_concat : public Item_sum
String *res;
char *end_ptr;
int error;
- res= val_str(&str_value);
+ if (!(res= val_str(&str_value)))
+ return (longlong) 0;
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);
Item *copy_or_same(THD* thd);