mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
MDEV-4677 GROUP_CONCAT not showing any output with group_concat_max_len >= 4Gb
don't allow group_concat_max_len values >= 4Gb (they never worked anyway)
This commit is contained in:
@@ -3171,7 +3171,7 @@ int dump_leaf_key(void* key_arg, element_count count __attribute__((unused)),
|
||||
{
|
||||
Item_func_group_concat *item= (Item_func_group_concat *) item_arg;
|
||||
TABLE *table= item->table;
|
||||
uint max_length= (uint)table->in_use->variables.group_concat_max_len;
|
||||
uint max_length= table->in_use->variables.group_concat_max_len;
|
||||
String tmp((char *)table->record[1], table->s->reclength,
|
||||
default_charset_info);
|
||||
String tmp2;
|
||||
@@ -3499,7 +3499,7 @@ bool Item_func_group_concat::repack_tree(THD *thd)
|
||||
DBUG_ASSERT(tree->size_of_element == st.tree.size_of_element);
|
||||
st.table= table;
|
||||
st.len= 0;
|
||||
st.maxlen= (size_t)thd->variables.group_concat_max_len;
|
||||
st.maxlen= thd->variables.group_concat_max_len;
|
||||
tree_walk(tree, ©_to_tree, &st, left_root_right);
|
||||
if (st.len <= st.maxlen) // Copying aborted. Must be OOM
|
||||
{
|
||||
@@ -3520,7 +3520,7 @@ bool Item_func_group_concat::repack_tree(THD *thd)
|
||||
decreases up to N=10 (that is, factor=1024) and then starts to increase,
|
||||
again, very slowly.
|
||||
*/
|
||||
#define GCONCAT_REPACK_FACTOR (1 << 10)
|
||||
#define GCONCAT_REPACK_FACTOR 10
|
||||
|
||||
bool Item_func_group_concat::add()
|
||||
{
|
||||
@@ -3566,7 +3566,7 @@ bool Item_func_group_concat::add()
|
||||
{
|
||||
THD *thd= table->in_use;
|
||||
table->field[0]->store(row_str_len, FALSE);
|
||||
if (tree_len > thd->variables.group_concat_max_len * GCONCAT_REPACK_FACTOR
|
||||
if ((tree_len >> GCONCAT_REPACK_FACTOR) > thd->variables.group_concat_max_len
|
||||
&& tree->elements_in_tree > 1)
|
||||
if (repack_tree(thd))
|
||||
return 1;
|
||||
@@ -3624,9 +3624,9 @@ Item_func_group_concat::fix_fields(THD *thd, Item **ref)
|
||||
result.set_charset(collation.collation);
|
||||
result_field= 0;
|
||||
null_value= 1;
|
||||
max_length= (uint32)(thd->variables.group_concat_max_len
|
||||
/ collation.collation->mbminlen
|
||||
* collation.collation->mbmaxlen);
|
||||
max_length= (uint32)MY_MIN(thd->variables.group_concat_max_len
|
||||
/ collation.collation->mbminlen
|
||||
* collation.collation->mbmaxlen, UINT_MAX32);
|
||||
|
||||
uint32 offset;
|
||||
if (separator->needs_conversion(separator->length(), separator->charset(),
|
||||
|
Reference in New Issue
Block a user