summaryrefslogtreecommitdiff
path: root/sql/sql_table.cc
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2020-05-14 16:18:01 +0200
committerSergei Golubchik <serg@mariadb.org>2020-05-27 15:56:40 +0200
commitb01c8a6cc8b361c6c8ecd887f1958c1f0b2e9811 (patch)
tree5c8bb5d4d3a62c99a0d596ea72328f3f8beeb20a /sql/sql_table.cc
parent39c141b4ae9e6381f9efd4c566e61b91371a3d63 (diff)
downloadmariadb-git-b01c8a6cc8b361c6c8ecd887f1958c1f0b2e9811.tar.gz
MDEV-22558 wrong error for invalid utf8 table comment
Diffstat (limited to 'sql/sql_table.cc')
-rw-r--r--sql/sql_table.cc19
1 files changed, 19 insertions, 0 deletions
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index 8d81911bf29..87d84b1abc6 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -4294,6 +4294,25 @@ bool validate_comment_length(THD *thd, LEX_STRING *comment, size_t max_len,
Well_formed_prefix(system_charset_info, *comment, max_len).length();
if (tmp_len < comment->length)
{
+#if MARIADB_VERSION_ID < 100500
+ if (comment->length <= max_len)
+ {
+ if (thd->is_strict_mode())
+ {
+ my_error(ER_INVALID_CHARACTER_STRING, MYF(0),
+ system_charset_info->csname, comment->str);
+ DBUG_RETURN(true);
+ }
+ push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
+ ER_INVALID_CHARACTER_STRING,
+ ER_THD(thd, ER_INVALID_CHARACTER_STRING),
+ system_charset_info->csname, comment->str);
+ comment->length= tmp_len;
+ DBUG_RETURN(false);
+ }
+#else
+#error do it in TEXT_STRING_sys
+#endif
if (thd->is_strict_mode())
{
my_error(err_code, MYF(0), name, static_cast<ulong>(max_len));