fix mysqltest for implicit cast of charset convert
This commit is contained in:
@ -285,15 +285,16 @@ int ObExprColumnConv::calc_result_typeN(ObExprResType &type,
|
||||
LOG_WARN("inconsistent datatypes", "expected", type_tc, "got", value_tc);
|
||||
} else {
|
||||
bool is_ddl = const_cast<sql::ObSQLSessionInfo *>(type_ctx.get_session())->get_ddl_info().is_ddl();
|
||||
if (!is_ddl) {
|
||||
type_ctx.set_cast_mode(type_ctx.get_cast_mode() |
|
||||
type_ctx.get_raw_expr()->get_extra() |
|
||||
CM_COLUMN_CONVERT |
|
||||
CM_CHARSET_CONVERT_IGNORE_ERR);
|
||||
} else {
|
||||
type_ctx.set_cast_mode(type_ctx.get_cast_mode() |
|
||||
type_ctx.get_raw_expr()->get_extra() |
|
||||
CM_COLUMN_CONVERT);
|
||||
if (!is_ddl) {
|
||||
bool is_strict = is_strict_mode(type_ctx.get_session()->get_sql_mode());
|
||||
if (lib::is_mysql_mode() && is_strict) {
|
||||
//do nothing
|
||||
} else {
|
||||
type_ctx.set_cast_mode(type_ctx.get_cast_mode() | CM_CHARSET_CONVERT_IGNORE_ERR);
|
||||
}
|
||||
}
|
||||
types[4].set_calc_meta(type);
|
||||
}
|
||||
|
||||
@ -3776,10 +3776,15 @@ int ObRawExprUtils::try_add_cast_expr_above(ObRawExprFactory *expr_factory,
|
||||
K(session->get_current_query_string()));
|
||||
#endif
|
||||
} else {
|
||||
//setup implicit cast charset convert ignore error
|
||||
ObCastMode cm_zf = cm;
|
||||
if ((cm_zf & CM_COLUMN_CONVERT) != 0) {
|
||||
//if CM_CHARSET_CONVERT_IGNORE_ERR should be set is judged in column_conv expr.
|
||||
} else {
|
||||
cm_zf |= CM_CHARSET_CONVERT_IGNORE_ERR;
|
||||
}
|
||||
// setup zerofill cm
|
||||
// eg: select concat(cast(c_zf as char(10)), cast(col_no_zf as char(10))) from t1;
|
||||
ObCastMode cm_zf = cm;
|
||||
cm_zf |= CM_CHARSET_CONVERT_IGNORE_ERR;
|
||||
if (expr.get_result_type().has_result_flag(ZEROFILL_FLAG)) {
|
||||
cm_zf |= CM_ZERO_FILL;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user