fix cast string to number overflow bug

This commit is contained in:
st0 2021-08-20 19:04:12 +08:00 committed by wangzelin.wzl
parent fd70eda21f
commit 7dc47e8efa
2 changed files with 2 additions and 2 deletions

View File

@ -3681,7 +3681,7 @@ static int string_number(
ret = value.from_sci_opt(str.ptr(), str.length(), params, &res_precision, &res_scale);
// select cast('1e500' as decimal); -> max_val
// select cast('-1e500' as decimal); -> min_val
if (CM_IS_SET_MIN_IF_OVERFLOW(cast_mode) && ret == OB_NUMERIC_OVERFLOW) {
if (ret == OB_NUMERIC_OVERFLOW) {
int64_t i = 0;
while (i < str.length() && isspace(str[i])) {
++i;

View File

@ -844,7 +844,7 @@ static OB_INLINE int common_string_number(
ret = nmb.from_sci_opt(in_str.ptr(), in_str.length(), alloc, &res_precision, &res_scale);
// select cast('1e500' as decimal); -> max_val
// select cast('-1e500' as decimal); -> min_val
if (OB_NUMERIC_OVERFLOW == ret && CM_IS_SET_MIN_IF_OVERFLOW(expr.extra_)) {
if (OB_NUMERIC_OVERFLOW == ret) {
int64_t i = 0;
while (i < in_str.length() && isspace(in_str[i])) {
++i;