Commit c6b54efe authored by unknown's avatar unknown

create.test, create.result, sql_select.cc, item.cc:

  After merge fix for bug #12537


sql/item.cc:
  After merge fix for bug #12537
sql/sql_select.cc:
  After merge fix for bug #12537
mysql-test/r/create.result:
  After merge fix for bug #12537
mysql-test/t/create.test:
  After merge fix for bug #12537
parent a1f59825
...@@ -597,11 +597,10 @@ create table t1(t1.name int); ...@@ -597,11 +597,10 @@ create table t1(t1.name int);
create table t2(test.t2.name int); create table t2(test.t2.name int);
drop table t1,t2; drop table t1,t2;
CREATE TABLE t1 (f1 VARCHAR(255) CHARACTER SET utf8); 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) CREATE TABLE t2 AS SELECT LEFT(f1,171) AS f2 FROM t1 UNION SELECT LEFT(f1,171) AS f2 FROM t1;
AS f2 FROM t1;
DESC t2; DESC t2;
Field Type Null Key Default Extra Field Type Null Key Default Extra
f2 varchar(86) YES NULL f2 varchar(171) YES NULL
DROP TABLE t1,t2; DROP TABLE t1,t2;
create database mysqltest; create database mysqltest;
use mysqltest; use mysqltest;
......
...@@ -507,8 +507,7 @@ drop table t1,t2; ...@@ -507,8 +507,7 @@ drop table t1,t2;
# Bug #12537: UNION produces longtext instead of varchar # Bug #12537: UNION produces longtext instead of varchar
# #
CREATE TABLE t1 (f1 VARCHAR(255) CHARACTER SET utf8); 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) CREATE TABLE t2 AS SELECT LEFT(f1,171) AS f2 FROM t1 UNION SELECT LEFT(f1,171) AS f2 FROM t1;
AS f2 FROM t1;
DESC t2; DESC t2;
DROP TABLE t1,t2; DROP TABLE t1,t2;
......
...@@ -3648,7 +3648,8 @@ enum_field_types Item::field_type() const ...@@ -3648,7 +3648,8 @@ enum_field_types Item::field_type() const
Field *Item::make_string_field(TABLE *table) 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, return new Field_blob(max_length, maybe_null, name, table,
collation.collation); collation.collation);
if (max_length > 0) if (max_length > 0)
......
...@@ -7963,7 +7963,8 @@ static Field *create_tmp_field_from_item(THD *thd, Item *item, TABLE *table, ...@@ -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 || if ((type= item->field_type()) == MYSQL_TYPE_DATETIME ||
type == MYSQL_TYPE_TIME || type == MYSQL_TYPE_DATE) type == MYSQL_TYPE_TIME || type == MYSQL_TYPE_DATE)
new_field= item->tmp_table_field_from_field_type(table); 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, new_field= new Field_varstring(convert_blob_length, maybe_null,
item->name, table, item->name, table,
item->collation.collation); item->collation.collation);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment