[CP] fix CHAR and CONCAT result length bug

This commit is contained in:
obdev
2023-01-10 09:08:10 +00:00
committed by ob-robot
parent 9c56a1418b
commit 080ca3a2dd
2 changed files with 4 additions and 5 deletions

View File

@ -73,11 +73,7 @@ int ObExprChar::calc_result_typeN(ObExprResType &type, ObExprResType *types, int
types[i].set_calc_type(ObIntType);
}
ObExprOperator::calc_result_flagN(type, types, param_num);
//set length
CK( OB_INVALID_COUNT != type_ctx.get_max_allowed_packet());
if (OB_SUCC(ret)) {
type.set_length(static_cast<ObLength>(type_ctx.get_max_allowed_packet()));
}
type.set_length(static_cast<ObLength>(param_num * 4 - 4));
}
return ret;
}

View File

@ -208,6 +208,9 @@ int ObExprConcat::calc_result_typeN(ObExprResType &type,
max_len = OB_MAX_LONGTEXT_LENGTH / 4;
} else {
max_len = MIN(OB_MAX_VARCHAR_LENGTH, max_len);
if (max_len <= 0) {
max_len = OB_MAX_VARCHAR_LENGTH;
}
}
type.set_length(max_len);
}