Commit 719e3565 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 edbb643f bd0fdb2f
...@@ -576,3 +576,23 @@ group_concat('x') ...@@ -576,3 +576,23 @@ group_concat('x')
NULL NULL
1 1
drop table t1; 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; ...@@ -373,4 +373,20 @@ select * from (select group_concat(a) from t1) t2;
select group_concat('x') UNION ALL select 1; select group_concat('x') UNION ALL select 1;
drop table t1; 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 # End of 4.1 tests
...@@ -2740,8 +2740,10 @@ int dump_leaf_key(byte* key, element_count count __attribute__((unused)), ...@@ -2740,8 +2740,10 @@ int dump_leaf_key(byte* key, element_count count __attribute__((unused)),
String *result= &item->result; String *result= &item->result;
Item **arg= item->args, **arg_end= item->args + item->arg_count_field; Item **arg= item->args, **arg_end= item->args + item->arg_count_field;
if (result->length()) if (item->no_appended)
result->append(*item->separator); item->no_appended= FALSE;
else
item->result.append(*item->separator);
tmp.length(0); tmp.length(0);
...@@ -2925,6 +2927,7 @@ void Item_func_group_concat::clear() ...@@ -2925,6 +2927,7 @@ void Item_func_group_concat::clear()
result.copy(); result.copy();
null_value= TRUE; null_value= TRUE;
warning_for_row= FALSE; warning_for_row= FALSE;
no_appended= TRUE;
if (tree) if (tree)
reset_tree(tree); reset_tree(tree);
/* No need to reset the table as we never call write_row */ /* No need to reset the table as we never call write_row */
...@@ -2969,6 +2972,12 @@ bool Item_func_group_concat::add() ...@@ -2969,6 +2972,12 @@ bool Item_func_group_concat::add()
} }
void Item_func_group_concat::reset_field()
{
DBUG_ASSERT(0);
}
bool bool
Item_func_group_concat::fix_fields(THD *thd, Item **ref) 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