mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
Fixed a bug in concat_ws(), which did not add concat separator
in case of an empty string. Bug ID 586.
This commit is contained in:
@ -64,7 +64,7 @@ concat_ws(NULL,'a') concat_ws(',',NULL,'')
|
|||||||
NULL
|
NULL
|
||||||
select concat_ws(',','',NULL,'a');
|
select concat_ws(',','',NULL,'a');
|
||||||
concat_ws(',','',NULL,'a')
|
concat_ws(',','',NULL,'a')
|
||||||
a
|
,a
|
||||||
SELECT CONCAT('"',CONCAT_WS('";"',repeat('a',60),repeat('b',60),repeat('c',60),repeat('d',100)), '"');
|
SELECT CONCAT('"',CONCAT_WS('";"',repeat('a',60),repeat('b',60),repeat('c',60),repeat('d',100)), '"');
|
||||||
CONCAT('"',CONCAT_WS('";"',repeat('a',60),repeat('b',60),repeat('c',60),repeat('d',100)), '"')
|
CONCAT('"',CONCAT_WS('";"',repeat('a',60),repeat('b',60),repeat('c',60),repeat('d',100)), '"')
|
||||||
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb";"cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc";"dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd"
|
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb";"cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc";"dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd"
|
||||||
|
@ -495,18 +495,18 @@ String *Item_func_concat_ws::val_str(String *str)
|
|||||||
str->length(0); // QQ; Should be removed
|
str->length(0); // QQ; Should be removed
|
||||||
res=str;
|
res=str;
|
||||||
|
|
||||||
// Skip until non-null and non-empty argument is found.
|
// Skip until non-null argument is found.
|
||||||
// If not, return the empty string
|
// If not, return the empty string
|
||||||
for (i=0; i < arg_count; i++)
|
for (i=0; i < arg_count; i++)
|
||||||
if ((res= args[i]->val_str(str)) && res->length())
|
if ((res= args[i]->val_str(str)))
|
||||||
break;
|
break;
|
||||||
if (i == arg_count)
|
if (i == arg_count)
|
||||||
return &empty_string;
|
return &empty_string;
|
||||||
|
|
||||||
for (i++; i < arg_count ; i++)
|
for (i++; i < arg_count ; i++)
|
||||||
{
|
{
|
||||||
if (!(res2= args[i]->val_str(use_as_buff)) || !res2->length())
|
if (!(res2= args[i]->val_str(use_as_buff)))
|
||||||
continue; // Skip NULL and empty string
|
continue; // Skip NULL
|
||||||
|
|
||||||
if (res->length() + sep_str->length() + res2->length() >
|
if (res->length() + sep_str->length() + res2->length() >
|
||||||
current_thd->variables.max_allowed_packet)
|
current_thd->variables.max_allowed_packet)
|
||||||
|
Reference in New Issue
Block a user