From b01c8a6cc8b361c6c8ecd887f1958c1f0b2e9811 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Thu, 14 May 2020 16:18:01 +0200 Subject: MDEV-22558 wrong error for invalid utf8 table comment --- sql/sql_table.cc | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'sql/sql_table.cc') 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(max_len)); -- cgit v1.2.1