Below is the list of changes that have just been committed into a local
4.1 repository of evgen. When evgen does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet
1.2386 05/08/23 17:34:38 evgen@stripped +4 -0
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.
mysql-test/t/create.test
1.57 05/08/23 17:34:08 evgen@stripped +9 -0
Test case for bug #12537 UNION produces longtext instead of varchar
mysql-test/r/create.result
1.84 05/08/23 17:33:43 evgen@stripped +7 -0
Test case for bug #12537 UNION produces longtext instead of varchar
sql/sql_select.cc
1.431 05/08/23 17:33:13 evgen@stripped +2 -1
Fix bug #12537 UNION produces longtext instead of varchar
create_tmp_field_from_item()now taking into account max char width when creating tmp
field for string fields.
sql/item.cc
1.217 05/08/23 17:31:22 evgen@stripped +4 -2
Fix bug #12537 UNION produces longtext instead of varchar
Item::tmp_table_field_from_field_type() now taking into account max char width when
creating tmp field for string fields.
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: evgen
# Host: moonbone.local
# Root: /work/12537-bug-4.1-mysql
--- 1.216/sql/item.cc 2005-08-17 12:26:27 +04:00
+++ 1.217/sql/item.cc 2005-08-23 17:31:22 +04:00
@@ -2022,12 +2022,14 @@
case MYSQL_TYPE_ENUM:
case MYSQL_TYPE_SET:
case MYSQL_TYPE_VAR_STRING:
- if (max_length > 255)
+ if ((max_length > 255 && !collation.collation) ||
+ max_length/collation.collation->mbmaxlen > 255)
break; // If blob
return new Field_varstring(max_length, maybe_null, name, table,
collation.collation);
case MYSQL_TYPE_STRING:
- if (max_length > 255) // If blob
+ if ((max_length > 255 && !collation.collation) ||
+ max_length/collation.collation->mbmaxlen > 255) // If blob
break;
return new Field_string(max_length, maybe_null, name, table,
collation.collation);
--- 1.430/sql/sql_select.cc 2005-08-16 08:26:07 +04:00
+++ 1.431/sql/sql_select.cc 2005-08-23 17:33:13 +04:00
@@ -4899,7 +4899,8 @@
item->name, table, item->unsigned_flag);
break;
case STRING_RESULT:
- if (item->max_length > 255)
+ if ((item->max_length > 255 && !item->collation.collation) ||
+ item->max_length/item->collation.collation->mbmaxlen > 255)
{
if (convert_blob_length)
new_field= new Field_varstring(convert_blob_length, maybe_null,
--- 1.83/mysql-test/r/create.result 2005-07-22 07:08:45 +04:00
+++ 1.84/mysql-test/r/create.result 2005-08-23 17:33:43 +04:00
@@ -580,6 +580,13 @@
create table t1(t1.name int);
create table t2(test.t2.name int);
drop table t1,t2;
+CREATE TABLE t1 (f1 VARCHAR(255) CHARACTER SET utf8);
+CREATE TABLE t2 AS SELECT LEFT(f1,86) AS f2 FROM t1 UNION SELECT LEFT(f1,86)
+AS f2 FROM t1;
+DESC t2;
+Field Type Null Key Default Extra
+f2 varchar(86) YES NULL
+DROP TABLE t1,t2;
create database mysqltest;
use mysqltest;
drop database mysqltest;
--- 1.56/mysql-test/t/create.test 2005-07-28 04:21:39 +04:00
+++ 1.57/mysql-test/t/create.test 2005-08-23 17:34:08 +04:00
@@ -493,6 +493,15 @@
drop table t1,t2;
#
+# Bug #12537: UNION produces longtext instead of varchar
+#
+CREATE TABLE t1 (f1 VARCHAR(255) CHARACTER SET utf8);
+CREATE TABLE t2 AS SELECT LEFT(f1,86) AS f2 FROM t1 UNION SELECT LEFT(f1,86)
+AS f2 FROM t1;
+DESC t2;
+DROP TABLE t1,t2;
+
+#
# Bug#11028: Crash on create table like
#
create database mysqltest;
| Thread |
|---|
| • bk commit into 4.1 tree (evgen:1.2386) BUG#12537 | eugene | 23 Aug |