summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Barkov <bar@mariadb.com>2018-06-21 15:17:15 +0400
committerAlexander Barkov <bar@mariadb.com>2018-06-21 15:17:15 +0400
commitfe3f9fa9183ea3d10397b6f7f4d422ae9bba00a4 (patch)
tree06bfccdf616a96ed15d061b9951ef806f78f156e
parent635c5e32815389bff928c3141e418b3cd2c5b887 (diff)
downloadmariadb-git-fe3f9fa9183ea3d10397b6f7f4d422ae9bba00a4.tar.gz
MDEV-12809 Bad column type created for TEXT(1431655798) CHARACTER SET utf8
-rw-r--r--mysql-test/r/type_blob.result16
-rw-r--r--mysql-test/t/type_blob.test18
-rw-r--r--sql/field.cc2
3 files changed, 35 insertions, 1 deletions
diff --git a/mysql-test/r/type_blob.result b/mysql-test/r/type_blob.result
index 569ba65df3f..3c99366168c 100644
--- a/mysql-test/r/type_blob.result
+++ b/mysql-test/r/type_blob.result
@@ -1063,3 +1063,19 @@ DROP TABLE t1;
#
# End of 5.5 tests
#
+#
+# Start of 10.2 test
+#
+#
+# MDEV-12809 Bad column type created for TEXT(1431655798) CHARACTER SET utf8
+#
+CREATE TABLE t1 (a TEXT(1431655798) CHARACTER SET utf8);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` longtext CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1;
+#
+# End of 10.2 test
+#
diff --git a/mysql-test/t/type_blob.test b/mysql-test/t/type_blob.test
index 8db6ac6da2a..2c74d4ea241 100644
--- a/mysql-test/t/type_blob.test
+++ b/mysql-test/t/type_blob.test
@@ -680,3 +680,21 @@ DROP TABLE t1;
--echo #
--echo # End of 5.5 tests
--echo #
+
+
+--echo #
+--echo # Start of 10.2 test
+--echo #
+
+--echo #
+--echo # MDEV-12809 Bad column type created for TEXT(1431655798) CHARACTER SET utf8
+--echo #
+
+CREATE TABLE t1 (a TEXT(1431655798) CHARACTER SET utf8);
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+
+
+--echo #
+--echo # End of 10.2 test
+--echo #
diff --git a/sql/field.cc b/sql/field.cc
index 56948acd8ba..f540c58757f 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -9777,7 +9777,7 @@ void Column_definition::create_length_to_internal_length(void)
case MYSQL_TYPE_STRING:
case MYSQL_TYPE_VARCHAR:
length*= charset->mbmaxlen;
- DBUG_ASSERT(length <= UINT_MAX32);
+ set_if_smaller(length, UINT_MAX32);
key_length= (uint32)length;
pack_length= calc_pack_length(sql_type, key_length);
break;