summaryrefslogtreecommitdiff
path: root/sql/sql_select.cc
diff options
context:
space:
mode:
authorevgen@moonbone.local <>2005-08-30 16:19:53 +0400
committerevgen@moonbone.local <>2005-08-30 16:19:53 +0400
commitd76f9471cbc6e6916b4124320afa60a1dc92ef5a (patch)
tree16edb78ed35954aaea1fb2952d968d34154e5c27 /sql/sql_select.cc
parent6e84ca33d9b5fff45ac0d940d47606b4e3a455a0 (diff)
downloadmariadb-git-d76f9471cbc6e6916b4124320afa60a1dc92ef5a.tar.gz
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.
Diffstat (limited to 'sql/sql_select.cc')
-rw-r--r--sql/sql_select.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 9984cb4138f..d5890997295 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -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,