[CP] fix inheriting zerofill attribute incorrectly

This commit is contained in:
obdev
2024-02-08 02:32:48 +00:00
committed by ob-robot
parent 68e7a1a152
commit 6a7c171057
4 changed files with 8 additions and 6 deletions

View File

@ -1766,6 +1766,7 @@ void ObSQLUtils::get_default_cast_mode(const bool is_explicit_cast,
}
int ObSQLUtils::get_cast_mode_for_replace(const ObRawExpr *expr,
const ObExprResType &dst_type,
const ObSQLSessionInfo *session,
ObCastMode &cast_mode)
{
@ -1779,7 +1780,8 @@ int ObSQLUtils::get_cast_mode_for_replace(const ObRawExpr *expr,
LOG_WARN("failed to get default cast mode", K(ret));
} else if (OB_FAIL(ObSQLUtils::set_cs_level_cast_mode(expr->get_collation_level(), cast_mode))) {
LOG_WARN("failed to set cs level cast mode", K(ret));
} else if (expr->get_result_type().has_result_flag(ZEROFILL_FLAG)) {
} else if (lib::is_mysql_mode() && dst_type.is_string_type() &&
expr->get_result_type().has_result_flag(ZEROFILL_FLAG)) {
cast_mode |= CM_ADD_ZEROFILL;
}
cast_mode = CM_SET_BY_TRANSFORMERN(cast_mode);