From 0becd6e9cb9f3aca3e7c7cd0b932f1a5153edf7c Mon Sep 17 00:00:00 2001 From: renju96 Date: Fri, 17 Mar 2023 08:14:09 +0000 Subject: [PATCH] Fix errcode to be compatible with mysql --- src/rootserver/ob_ddl_service.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/rootserver/ob_ddl_service.cpp b/src/rootserver/ob_ddl_service.cpp index d7c2f5a981..7ed3c83bd8 100644 --- a/src/rootserver/ob_ddl_service.cpp +++ b/src/rootserver/ob_ddl_service.cpp @@ -3367,8 +3367,13 @@ int ObDDLService::check_convert_to_character(obrpc::ObAlterTableArg &alter_table alter_table_schema.set_collation_type(collation_type); alter_table_schema.set_charset_type(charset_type); } else if (!ObCharset::is_valid_collation(charset_type, collation_type)) { - ret = OB_ERR_UNEXPECTED; - LOG_WARN("invalid charset", K(ret), K(charset_type), K(collation_type)); + ret = OB_ERR_COLLATION_MISMATCH; + const char *cs_name = ObCharset::charset_name(charset_type); + const char *coll_name = ObCharset::collation_name(collation_type); + ObString charset = ObString::make_string(cs_name); + ObString collation = ObString::make_string(coll_name); + LOG_USER_ERROR(OB_ERR_COLLATION_MISMATCH, collation.length(), collation.ptr(), + charset.length(), charset.ptr()); } // This is to do a performance optimization. If the collation_type of the original table is // equivalent to the new collation_type, do nothing -- GitLab