From 2a0f08c519257c0a5123c244731414994e46f5e7 Mon Sep 17 00:00:00 2001
From: unknown <ram@mysql.r18.ru>
Date: Fri, 11 Jul 2003 14:17:18 +0500
Subject: [PATCH] Fix for the bug #801: create table t1 select x'41'; doesn't
 work

---
 mysql-test/r/create.result | 2 ++
 mysql-test/t/create.test   | 7 +++++++
 sql/sql_select.cc          | 1 +
 3 files changed, 10 insertions(+)

diff --git a/mysql-test/r/create.result b/mysql-test/r/create.result
index 2e2aa41c671..e6192eb6ccb 100644
--- a/mysql-test/r/create.result
+++ b/mysql-test/r/create.result
@@ -176,3 +176,5 @@ Column 'k1' cannot be null
 insert into t1 values (NULL, NULL);
 Column 'k1' cannot be null
 drop table t1;
+create table t1 select x'4132';
+drop table t1;
diff --git a/mysql-test/t/create.test b/mysql-test/t/create.test
index 86c3f6be0f5..d46807f1dca 100644
--- a/mysql-test/t/create.test
+++ b/mysql-test/t/create.test
@@ -127,3 +127,10 @@ insert into t1 values ("a", 1), ("b", 2);
 !$1048 insert into t1 values (NULL, 3);
 !$1048 insert into t1 values (NULL, NULL);
 drop table t1;
+
+#
+# Bug # 801
+#
+
+create table t1 select x'4132';
+drop table t1;
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 80e329a7f03..4008bf75f01 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -3664,6 +3664,7 @@ Field *create_tmp_field(THD *thd, TABLE *table,Item *item, Item::Type type,
   case Item::STRING_ITEM:
   case Item::REF_ITEM:
   case Item::NULL_ITEM:
+  case Item::VARBIN_ITEM:
   {
     bool maybe_null=item->maybe_null;
     Field *new_field;
-- 
2.30.9