1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

Fix bug #12537 UNION produces longtext instead of varchar

Item::tmp_table_field_from_field_type() and create_tmp_field_from_item()
was converting string field to blob depending on byte-wise length instead of
character length, which results in converting valid varchar string with
length == 86 to longtext.

Made that functions above take into account max width of character when
converting string fields to blobs.
This commit is contained in:
evgen@moonbone.local
2005-08-30 16:19:53 +04:00
parent 6e84ca33d9
commit d76f9471cb
4 changed files with 22 additions and 3 deletions

View File

@ -4899,7 +4899,8 @@ static Field* create_tmp_field_from_item(THD *thd, Item *item, TABLE *table,
item->name, table, item->unsigned_flag);
break;
case STRING_RESULT:
if (item->max_length > 255)
DBUG_ASSERT(item->collation.collation);
if (item->max_length/item->collation.collation->mbmaxlen > 255)
{
if (convert_blob_length)
new_field= new Field_varstring(convert_blob_length, maybe_null,