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
|
||||
select 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)), '"');
|
||||
CONCAT('"',CONCAT_WS('";"',repeat('a',60),repeat('b',60),repeat('c',60),repeat('d',100)), '"')
|
||||
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb";"cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc";"dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd"
|
||||
|
@ -495,18 +495,18 @@ String *Item_func_concat_ws::val_str(String *str)
|
||||
str->length(0); // QQ; Should be removed
|
||||
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
|
||||
for (i=0; i < arg_count; i++)
|
||||
if ((res= args[i]->val_str(str)) && res->length())
|
||||
if ((res= args[i]->val_str(str)))
|
||||
break;
|
||||
if (i == arg_count)
|
||||
return &empty_string;
|
||||
|
||||
for (i++; i < arg_count ; i++)
|
||||
{
|
||||
if (!(res2= args[i]->val_str(use_as_buff)) || !res2->length())
|
||||
continue; // Skip NULL and empty string
|
||||
if (!(res2= args[i]->val_str(use_as_buff)))
|
||||
continue; // Skip NULL
|
||||
|
||||
if (res->length() + sep_str->length() + res2->length() >
|
||||
current_thd->variables.max_allowed_packet)
|
||||
|
Reference in New Issue
Block a user