Fix last_insert_id expr bugs

This commit is contained in:
hezuojiao
2023-07-12 05:23:59 +00:00
committed by ob-robot
parent e14bf1064c
commit f2ff2cfe02
2 changed files with 24 additions and 1 deletions

View File

@ -45,7 +45,14 @@ int ObExprLastInsertID::calc_result_typeN(ObExprResType &type,
type.set_precision(ObAccuracy::DDL_DEFAULT_ACCURACY[ObUInt64Type].precision_);
type.set_result_flag(NOT_NULL_FLAG);
if (1 == param_num) {
types_array[0].set_calc_type(ObUInt64Type);
const ObObjType arg_type = types_array[0].get_type();
if (ob_is_int_tc(arg_type) || ob_is_uint_tc(arg_type)) {
// get the uint value directly without extra cast
} else if (ob_is_number_tc(arg_type)) {
types_array[0].set_calc_type(ObIntType);
} else {
types_array[0].set_calc_type(ObUInt64Type);
}
}
return OB_SUCCESS;
}