Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
ac3ce653
Commit
ac3ce653
authored
Nov 08, 2006
by
bar@mysql.com/bar.intranet.mysql.r18.ru
Browse files
Options
Browse Files
Download
Plain Diff
Merge mysql.com:/usr/home/bar/mysql-4.1.b23451v2
into mysql.com:/usr/home/bar/mysql-5.0.b23451
parents
aea1e14e
599b7316
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
122 additions
and
3 deletions
+122
-3
mysql-test/r/func_gconcat.result
mysql-test/r/func_gconcat.result
+70
-0
mysql-test/t/func_gconcat.test
mysql-test/t/func_gconcat.test
+35
-0
sql/item_sum.cc
sql/item_sum.cc
+17
-3
No files found.
mysql-test/r/func_gconcat.result
View file @
ac3ce653
...
...
@@ -658,3 +658,73 @@ GROUP_CONCAT(a) x
2 1,2
1 2,3
DROP TABLE t1;
set names utf8;
create table t1
(
x text character set utf8 not null,
y integer not null
);
insert into t1 values (repeat('a', 1022), 0), (repeat(_utf8 0xc3b7, 4), 0);
set group_concat_max_len= 1022 + 10;
select @x:=group_concat(x) from t1 group by y;
select @@group_concat_max_len, length(@x), char_length(@x), right(@x,12), right(HEX(@x),12);
@@group_concat_max_len length(@x) char_length(@x) right(@x,12) right(HEX(@x),12)
1032 1031 1027 aaaaaaa,÷÷÷÷ C3B7C3B7C3B7
set group_concat_max_len= 1022 + 9;
select @x:=group_concat(x) from t1 group by y;
select @@group_concat_max_len, length(@x), char_length(@x), right(@x,12), right(HEX(@x),12);
@@group_concat_max_len length(@x) char_length(@x) right(@x,12) right(HEX(@x),12)
1031 1031 1027 aaaaaaa,÷÷÷÷ C3B7C3B7C3B7
set group_concat_max_len= 1022 + 8;
select @x:=group_concat(x) from t1 group by y;
select @@group_concat_max_len, length(@x), char_length(@x), right(@x,12), right(HEX(@x),12);
@@group_concat_max_len length(@x) char_length(@x) right(@x,12) right(HEX(@x),12)
1030 1029 1026 aaaaaaaa,÷÷÷ C3B7C3B7C3B7
set group_concat_max_len= 1022 + 7;
select @x:=group_concat(x) from t1 group by y;
select @@group_concat_max_len, length(@x), char_length(@x), right(@x,12), right(HEX(@x),12);
@@group_concat_max_len length(@x) char_length(@x) right(@x,12) right(HEX(@x),12)
1029 1029 1026 aaaaaaaa,÷÷÷ C3B7C3B7C3B7
set group_concat_max_len= 1022 + 6;
select @x:=group_concat(x) from t1 group by y;
select @@group_concat_max_len, length(@x), char_length(@x), right(@x,12), right(HEX(@x),12);
@@group_concat_max_len length(@x) char_length(@x) right(@x,12) right(HEX(@x),12)
1028 1027 1025 aaaaaaaaa,÷÷ 612CC3B7C3B7
set group_concat_max_len= 1022 + 5;
select @x:=group_concat(x) from t1 group by y;
select @@group_concat_max_len, length(@x), char_length(@x), right(@x,12), right(HEX(@x),12);
@@group_concat_max_len length(@x) char_length(@x) right(@x,12) right(HEX(@x),12)
1027 1027 1025 aaaaaaaaa,÷÷ 612CC3B7C3B7
set group_concat_max_len= 1022 + 4;
select @x:=group_concat(x) from t1 group by y;
select @@group_concat_max_len, length(@x), char_length(@x), right(@x,12), right(HEX(@x),12);
@@group_concat_max_len length(@x) char_length(@x) right(@x,12) right(HEX(@x),12)
1026 1025 1024 aaaaaaaaaa,÷ 6161612CC3B7
set group_concat_max_len= 1022 + 3;
select @x:=group_concat(x) from t1 group by y;
select @@group_concat_max_len, length(@x), char_length(@x), right(@x,12), right(HEX(@x),12);
@@group_concat_max_len length(@x) char_length(@x) right(@x,12) right(HEX(@x),12)
1025 1025 1024 aaaaaaaaaa,÷ 6161612CC3B7
set group_concat_max_len= 1022 + 2;
select @x:=group_concat(x) from t1 group by y;
select @@group_concat_max_len, length(@x), char_length(@x), right(@x,12), right(HEX(@x),12);
@@group_concat_max_len length(@x) char_length(@x) right(@x,12) right(HEX(@x),12)
1024 1023 1023 aaaaaaaaaaa, 61616161612C
set group_concat_max_len= 1022 + 1;
select @x:=group_concat(x) from t1 group by y;
select @@group_concat_max_len, length(@x), char_length(@x), right(@x,12), right(HEX(@x),12);
@@group_concat_max_len length(@x) char_length(@x) right(@x,12) right(HEX(@x),12)
1023 1023 1023 aaaaaaaaaaa, 61616161612C
drop table t1;
set group_concat_max_len=1024;
set names latin1;
create table t1 (f1 int unsigned, f2 varchar(255));
insert into t1 values (1,repeat('a',255)),(2,repeat('b',255));
select f2,group_concat(f1) from t1 group by f2;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def test t1 t1 f2 f2 253 255 255 Y 0 0 8
def group_concat(f1) 252 1024 1 Y 128 0 63
f2 group_concat(f1)
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 1
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb 2
drop table t1;
mysql-test/t/func_gconcat.test
View file @
ac3ce653
...
...
@@ -461,3 +461,38 @@ SELECT GROUP_CONCAT(a), x
GROUP
BY
x
;
DROP
TABLE
t1
;
#
# Bug#23451 GROUP_CONCAT truncates a multibyte utf8 character
#
set
names
utf8
;
create
table
t1
(
x
text
character
set
utf8
not
null
,
y
integer
not
null
);
insert
into
t1
values
(
repeat
(
'a'
,
1022
),
0
),
(
repeat
(
_utf8
0xc3b7
,
4
),
0
);
let
$
1
=
10
;
while
(
$
1
)
{
eval
set
group_concat_max_len
=
1022
+
$
1
;
--
disable_result_log
select
@
x
:=
group_concat
(
x
)
from
t1
group
by
y
;
--
enable_result_log
select
@@
group_concat_max_len
,
length
(
@
x
),
char_length
(
@
x
),
right
(
@
x
,
12
),
right
(
HEX
(
@
x
),
12
);
dec
$
1
;
}
drop
table
t1
;
set
group_concat_max_len
=
1024
;
set
names
latin1
;
#
# Bug#14169 type of group_concat() result changed to blob if tmp_table was used
#
create
table
t1
(
f1
int
unsigned
,
f2
varchar
(
255
));
insert
into
t1
values
(
1
,
repeat
(
'a'
,
255
)),(
2
,
repeat
(
'b'
,
255
));
--
enable_metadata
select
f2
,
group_concat
(
f1
)
from
t1
group
by
f2
;
--
disable_metadata
drop
table
t1
;
# End of 4.1 tests
sql/item_sum.cc
View file @
ac3ce653
...
...
@@ -3001,6 +3001,7 @@ int dump_leaf_key(byte* key, element_count count __attribute__((unused)),
String
tmp2
;
String
*
result
=
&
item
->
result
;
Item
**
arg
=
item
->
args
,
**
arg_end
=
item
->
args
+
item
->
arg_count_field
;
uint
old_length
=
result
->
length
();
if
(
item
->
no_appended
)
item
->
no_appended
=
FALSE
;
...
...
@@ -3035,8 +3036,22 @@ int dump_leaf_key(byte* key, element_count count __attribute__((unused)),
/* stop if length of result more than max_length */
if
(
result
->
length
()
>
item
->
max_length
)
{
int
well_formed_error
;
CHARSET_INFO
*
cs
=
item
->
collation
.
collation
;
const
char
*
ptr
=
item
->
result
.
ptr
();
uint
add_length
;
/*
It's ok to use item->result.length() as the fourth argument
as this is never used to limit the length of the data.
Cut is done with the third argument.
*/
add_length
=
cs
->
cset
->
well_formed_len
(
cs
,
ptr
+
old_length
,
ptr
+
item
->
group_concat_max_len
,
item
->
result
.
length
(),
&
well_formed_error
);
item
->
result
.
length
(
old_length
+
add_length
);
item
->
count_cut_values
++
;
result
->
length
(
item
->
max_length
);
item
->
warning_for_row
=
TRUE
;
return
1
;
}
...
...
@@ -3226,8 +3241,7 @@ bool Item_func_group_concat::add()
we can dump the row here in case of GROUP_CONCAT(DISTINCT...)
instead of doing tree traverse later.
*/
if
(
result
.
length
()
<=
max_length
&&
!
warning_for_row
&&
if
(
!
warning_for_row
&&
(
!
tree
||
(
el
->
count
==
1
&&
distinct
&&
!
arg_count_order
)))
dump_leaf_key
(
table
->
record
[
0
]
+
table
->
s
->
null_bytes
,
1
,
this
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment