mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
MDEV-5542: GROUP_CONCAT truncate output to 65.536 chars when using DISTINCT or ORDER BY
port of mysql fix WL#6098
This commit is contained in:
@ -15751,8 +15751,6 @@ const_expression_in_where(COND *cond, Item *comp_item, Field *comp_field,
|
||||
the record in the original table.
|
||||
If item == NULL then fill_record() will update
|
||||
the temporary table
|
||||
@param convert_blob_length If >0 create a varstring(convert_blob_length)
|
||||
field instead of blob.
|
||||
|
||||
@retval
|
||||
NULL on error
|
||||
@ -15762,23 +15760,12 @@ const_expression_in_where(COND *cond, Item *comp_item, Field *comp_field,
|
||||
|
||||
Field *create_tmp_field_from_field(THD *thd, Field *org_field,
|
||||
const char *name, TABLE *table,
|
||||
Item_field *item, uint convert_blob_length)
|
||||
Item_field *item)
|
||||
{
|
||||
Field *new_field;
|
||||
|
||||
/*
|
||||
Make sure that the blob fits into a Field_varstring which has
|
||||
2-byte lenght.
|
||||
*/
|
||||
if (convert_blob_length && convert_blob_length <= Field_varstring::MAX_SIZE &&
|
||||
(org_field->flags & BLOB_FLAG))
|
||||
new_field= new Field_varstring(convert_blob_length,
|
||||
org_field->maybe_null(),
|
||||
org_field->field_name, table->s,
|
||||
org_field->charset());
|
||||
else
|
||||
new_field= org_field->make_new_field(thd->mem_root, table,
|
||||
table == org_field->table);
|
||||
new_field= org_field->make_new_field(thd->mem_root, table,
|
||||
table == org_field->table);
|
||||
if (new_field)
|
||||
{
|
||||
new_field->init(table);
|
||||
@ -15820,8 +15807,6 @@ Field *create_tmp_field_from_field(THD *thd, Field *org_field,
|
||||
update the record in the original table.
|
||||
If modify_item is 0 then fill_record() will
|
||||
update the temporary table
|
||||
@param convert_blob_length If >0 create a varstring(convert_blob_length)
|
||||
field instead of blob.
|
||||
|
||||
@retval
|
||||
0 on error
|
||||
@ -15830,8 +15815,7 @@ Field *create_tmp_field_from_field(THD *thd, Field *org_field,
|
||||
*/
|
||||
|
||||
static Field *create_tmp_field_from_item(THD *thd, Item *item, TABLE *table,
|
||||
Item ***copy_func, bool modify_item,
|
||||
uint convert_blob_length)
|
||||
Item ***copy_func, bool modify_item)
|
||||
{
|
||||
bool maybe_null= item->maybe_null;
|
||||
Field *UNINIT_VAR(new_field);
|
||||
@ -15869,17 +15853,6 @@ static Field *create_tmp_field_from_item(THD *thd, Item *item, TABLE *table,
|
||||
if (item->cmp_type() == TIME_RESULT ||
|
||||
item->field_type() == MYSQL_TYPE_GEOMETRY)
|
||||
new_field= item->tmp_table_field_from_field_type(table, true, false);
|
||||
/*
|
||||
Make sure that the blob fits into a Field_varstring which has
|
||||
2-byte lenght.
|
||||
*/
|
||||
else if (item->max_length/item->collation.collation->mbmaxlen > 255 &&
|
||||
convert_blob_length <= Field_varstring::MAX_SIZE &&
|
||||
convert_blob_length)
|
||||
new_field= new (mem_root)
|
||||
Field_varstring(convert_blob_length, maybe_null,
|
||||
item->name, table->s,
|
||||
item->collation.collation);
|
||||
else
|
||||
new_field= item->make_string_field(table);
|
||||
new_field->set_derivation(item->collation.derivation);
|
||||
@ -15958,8 +15931,6 @@ Field *Item::create_field_for_schema(THD *thd, TABLE *table)
|
||||
the record in the original table.
|
||||
If modify_item is 0 then fill_record() will update
|
||||
the temporary table
|
||||
@param convert_blob_length If >0 create a varstring(convert_blob_length)
|
||||
field instead of blob.
|
||||
|
||||
@retval
|
||||
0 on error
|
||||
@ -15972,8 +15943,7 @@ Field *create_tmp_field(THD *thd, TABLE *table,Item *item, Item::Type type,
|
||||
Field **default_field,
|
||||
bool group, bool modify_item,
|
||||
bool table_cant_handle_bit_fields,
|
||||
bool make_copy_field,
|
||||
uint convert_blob_length)
|
||||
bool make_copy_field)
|
||||
{
|
||||
Field *result;
|
||||
Item::Type orig_type= type;
|
||||
@ -15991,7 +15961,7 @@ Field *create_tmp_field(THD *thd, TABLE *table,Item *item, Item::Type type,
|
||||
case Item::SUM_FUNC_ITEM:
|
||||
{
|
||||
Item_sum *item_sum=(Item_sum*) item;
|
||||
result= item_sum->create_tmp_field(group, table, convert_blob_length);
|
||||
result= item_sum->create_tmp_field(group, table);
|
||||
if (!result)
|
||||
my_error(ER_OUT_OF_RESOURCES, MYF(ME_FATALERROR));
|
||||
return result;
|
||||
@ -16027,7 +15997,7 @@ Field *create_tmp_field(THD *thd, TABLE *table,Item *item, Item::Type type,
|
||||
item->maybe_null= orig_item->maybe_null;
|
||||
}
|
||||
result= create_tmp_field_from_item(thd, item, table, NULL,
|
||||
modify_item, convert_blob_length);
|
||||
modify_item);
|
||||
*from_field= field->field;
|
||||
if (result && modify_item)
|
||||
field->result_field= result;
|
||||
@ -16039,7 +16009,7 @@ Field *create_tmp_field(THD *thd, TABLE *table,Item *item, Item::Type type,
|
||||
{
|
||||
*from_field= field->field;
|
||||
result= create_tmp_field_from_item(thd, item, table, copy_func,
|
||||
modify_item, convert_blob_length);
|
||||
modify_item);
|
||||
if (result && modify_item)
|
||||
field->result_field= result;
|
||||
}
|
||||
@ -16049,8 +16019,7 @@ Field *create_tmp_field(THD *thd, TABLE *table,Item *item, Item::Type type,
|
||||
item->name,
|
||||
table,
|
||||
modify_item ? field :
|
||||
NULL,
|
||||
convert_blob_length);
|
||||
NULL);
|
||||
if (orig_type == Item::REF_ITEM && orig_modify)
|
||||
((Item_ref*)orig_item)->set_result_field(result);
|
||||
/*
|
||||
@ -16084,8 +16053,7 @@ Field *create_tmp_field(THD *thd, TABLE *table,Item *item, Item::Type type,
|
||||
sp_result_field,
|
||||
item_func_sp->name,
|
||||
table,
|
||||
NULL,
|
||||
convert_blob_length);
|
||||
NULL);
|
||||
|
||||
if (modify_item)
|
||||
item->set_result_field(result_field);
|
||||
@ -16117,7 +16085,7 @@ Field *create_tmp_field(THD *thd, TABLE *table,Item *item, Item::Type type,
|
||||
}
|
||||
return create_tmp_field_from_item(thd, item, table,
|
||||
(make_copy_field ? 0 : copy_func),
|
||||
modify_item, convert_blob_length);
|
||||
modify_item);
|
||||
case Item::TYPE_HOLDER:
|
||||
result= ((Item_type_holder *)item)->make_field_by_type(table);
|
||||
result->set_derivation(item->collation.derivation);
|
||||
@ -16420,8 +16388,7 @@ create_tmp_table(THD *thd, TMP_TABLE_PARAM *param, List<Item> &fields,
|
||||
create_tmp_field(thd, table, arg, arg->type(), ©_func,
|
||||
tmp_from_field, &default_field[fieldnr],
|
||||
group != 0,not_all_columns,
|
||||
distinct, 0,
|
||||
param->convert_blob_length);
|
||||
distinct, false);
|
||||
if (!new_field)
|
||||
goto err; // Should be OOM
|
||||
tmp_from_field++;
|
||||
@ -16491,8 +16458,7 @@ create_tmp_table(THD *thd, TMP_TABLE_PARAM *param, List<Item> &fields,
|
||||
to be usable in this case too.
|
||||
*/
|
||||
item->marker == 4 || param->bit_fields_as_long,
|
||||
force_copy_fields,
|
||||
param->convert_blob_length);
|
||||
force_copy_fields);
|
||||
|
||||
if (!new_field)
|
||||
{
|
||||
|
Reference in New Issue
Block a user