mirror of
https://github.com/MariaDB/server.git
synced 2025-03-27 01:18:42 +01:00
func_gconcat.result, func_gconcat.test:
Added test cases for bug #12863. item_sum.cc, item_sum.h: Fixed bug #12863. Added a flag to Item_func_group_concat set to FALSE after concatenation of the first element of a group. sql/item_sum.h: Fixed bug #12863. Added a flag to Item_func_group_concat set to FALSE after concatenation of the first element of a group. sql/item_sum.cc: Fixed bug #12863. Added a flag to Item_func_group_concat set to FALSE after concatenation of the first element of a group. mysql-test/t/func_gconcat.test: Added test cases for bug #12863. mysql-test/r/func_gconcat.result: Added test cases for bug #12863.
This commit is contained in:
parent
291d59d4bf
commit
d877cdf3e7
4 changed files with 42 additions and 3 deletions
|
@ -560,3 +560,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;
|
||||
|
|
|
@ -356,4 +356,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
|
||||
|
|
|
@ -1664,7 +1664,9 @@ int dump_leaf_key(byte* key, uint32 count __attribute__((unused)),
|
|||
char buff[MAX_FIELD_WIDTH];
|
||||
String tmp((char *)&buff,sizeof(buff),default_charset_info), tmp2;
|
||||
|
||||
if (item->result.length())
|
||||
if (item->no_appended)
|
||||
item->no_appended= FALSE;
|
||||
else
|
||||
item->result.append(*item->separator);
|
||||
|
||||
tmp.length(0);
|
||||
|
@ -1856,6 +1858,7 @@ void Item_func_group_concat::clear()
|
|||
result.copy();
|
||||
null_value= TRUE;
|
||||
warning_for_row= FALSE;
|
||||
no_appended= TRUE;
|
||||
if (tree_mode)
|
||||
reset_tree(tree);
|
||||
}
|
||||
|
@ -1898,8 +1901,7 @@ bool Item_func_group_concat::add()
|
|||
|
||||
void Item_func_group_concat::reset_field()
|
||||
{
|
||||
if (tree_mode)
|
||||
reset_tree(tree);
|
||||
DBUG_ASSERT(0);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -709,6 +709,7 @@ class Item_func_group_concat : public Item_sum
|
|||
uint arg_count_field;
|
||||
uint field_list_offset;
|
||||
uint count_cut_values;
|
||||
bool no_appended;
|
||||
/*
|
||||
Following is 0 normal object and pointer to original one for copy
|
||||
(to correctly free resources)
|
||||
|
|
Loading…
Add table
Reference in a new issue