summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorevgen@moonbone.local <>2005-08-31 22:06:34 +0400
committerevgen@moonbone.local <>2005-08-31 22:06:34 +0400
commit41fc00641cf0bcab8bf52059c4e482c964f261fc (patch)
treef7dcfa6e75508b6e2bc70128e34d4021c2a93c01
parentf917803e0c1460325594c55bb5c08587af9c60e0 (diff)
downloadmariadb-git-41fc00641cf0bcab8bf52059c4e482c964f261fc.tar.gz
create.test, create.result, sql_select.cc, item.cc:
After merge fix for bug #12537
-rw-r--r--mysql-test/r/create.result5
-rw-r--r--mysql-test/t/create.test3
-rw-r--r--sql/item.cc3
-rw-r--r--sql/sql_select.cc3
4 files changed, 7 insertions, 7 deletions
diff --git a/mysql-test/r/create.result b/mysql-test/r/create.result
index c75dfa9c3db..e1e66019f65 100644
--- a/mysql-test/r/create.result
+++ b/mysql-test/r/create.result
@@ -597,11 +597,10 @@ 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;
+CREATE TABLE t2 AS SELECT LEFT(f1,171) AS f2 FROM t1 UNION SELECT LEFT(f1,171) AS f2 FROM t1;
DESC t2;
Field Type Null Key Default Extra
-f2 varchar(86) YES NULL
+f2 varchar(171) YES NULL
DROP TABLE t1,t2;
create database mysqltest;
use mysqltest;
diff --git a/mysql-test/t/create.test b/mysql-test/t/create.test
index 5cd92fbc21e..876ee1e3d5e 100644
--- a/mysql-test/t/create.test
+++ b/mysql-test/t/create.test
@@ -507,8 +507,7 @@ 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;
+CREATE TABLE t2 AS SELECT LEFT(f1,171) AS f2 FROM t1 UNION SELECT LEFT(f1,171) AS f2 FROM t1;
DESC t2;
DROP TABLE t1,t2;
diff --git a/sql/item.cc b/sql/item.cc
index 0bf6a9a2b5f..1bbef46c0c9 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -3648,7 +3648,8 @@ enum_field_types Item::field_type() const
Field *Item::make_string_field(TABLE *table)
{
- if (max_length > CONVERT_IF_BIGGER_TO_BLOB)
+ DBUG_ASSERT(collation.collation);
+ if (max_length/collation.collation->mbmaxlen > CONVERT_IF_BIGGER_TO_BLOB)
return new Field_blob(max_length, maybe_null, name, table,
collation.collation);
if (max_length > 0)
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 246076ac285..5ba2722482b 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -7963,7 +7963,8 @@ static Field *create_tmp_field_from_item(THD *thd, Item *item, TABLE *table,
if ((type= item->field_type()) == MYSQL_TYPE_DATETIME ||
type == MYSQL_TYPE_TIME || type == MYSQL_TYPE_DATE)
new_field= item->tmp_table_field_from_field_type(table);
- else if (item->max_length > 255 && convert_blob_length)
+ else if (item->max_length/item->collation.collation->mbmaxlen > 255 &&
+ convert_blob_length)
new_field= new Field_varstring(convert_blob_length, maybe_null,
item->name, table,
item->collation.collation);