Commit 91cb3d2d authored by unknown's avatar unknown

Manual merge


mysql-test/r/func_gconcat.result:
  Auto merged
mysql-test/t/func_gconcat.test:
  Auto merged
parents 0c51dc75 7d64ba09
......@@ -576,3 +576,23 @@ group_concat('x')
NULL
1
drop table t1;
CREATE TABLE t1 (id int, a varchar(9));
INSERT INTO t1 VALUES
(2, ''), (1, ''), (2, 'x'), (1, 'y'), (3, 'z'), (3, '');
SELECT GROUP_CONCAT(a) FROM t1;
GROUP_CONCAT(a)
,,x,y,z,
SELECT GROUP_CONCAT(a ORDER BY a) FROM t1;
GROUP_CONCAT(a ORDER BY a)
,,,x,y,z
SELECT GROUP_CONCAT(a) FROM t1 GROUP BY id;
GROUP_CONCAT(a)
,y
,x
z,
SELECT GROUP_CONCAT(a ORDER BY a) FROM t1 GROUP BY id;
GROUP_CONCAT(a ORDER BY a)
,y
,x
,z
DROP TABLE t1;
......@@ -373,4 +373,20 @@ select * from (select group_concat(a) from t1) t2;
select group_concat('x') UNION ALL select 1;
drop table t1;
#
# Bug #12863 : missing separators after first empty cancatanated elements
#
CREATE TABLE t1 (id int, a varchar(9));
INSERT INTO t1 VALUES
(2, ''), (1, ''), (2, 'x'), (1, 'y'), (3, 'z'), (3, '');
SELECT GROUP_CONCAT(a) FROM t1;
SELECT GROUP_CONCAT(a ORDER BY a) FROM t1;
SELECT GROUP_CONCAT(a) FROM t1 GROUP BY id;
SELECT GROUP_CONCAT(a ORDER BY a) FROM t1 GROUP BY id;
DROP TABLE t1;
# End of 4.1 tests
......@@ -2740,8 +2740,10 @@ int dump_leaf_key(byte* key, element_count count __attribute__((unused)),
String *result= &item->result;
Item **arg= item->args, **arg_end= item->args + item->arg_count_field;
if (result->length())
result->append(*item->separator);
if (item->no_appended)
item->no_appended= FALSE;
else
item->result.append(*item->separator);
tmp.length(0);
......@@ -2925,6 +2927,7 @@ void Item_func_group_concat::clear()
result.copy();
null_value= TRUE;
warning_for_row= FALSE;
no_appended= TRUE;
if (tree)
reset_tree(tree);
/* No need to reset the table as we never call write_row */
......@@ -2969,6 +2972,12 @@ bool Item_func_group_concat::add()
}
void Item_func_group_concat::reset_field()
{
DBUG_ASSERT(0);
}
bool
Item_func_group_concat::fix_fields(THD *thd, Item **ref)
{
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment