Fix a bug of omitting to set res type length for lob exprs

This commit is contained in:
obdev
2023-04-13 08:40:19 +00:00
committed by ob-robot
parent 475b0fa975
commit 3926fdba2f
8 changed files with 37 additions and 4 deletions

View File

@ -47,6 +47,16 @@ int ObExprToBlob::calc_result_type1(ObExprResType &type,
|| ob_is_string_tc(text.get_type())) {
type.set_blob();
type.set_collation_type(CS_TYPE_BINARY);
if (ob_is_string_tc(text.get_type())) {
ObLength length = text.get_length();
if (LS_CHAR == text.get_length_semantics()) {
length *= ObCharset::get_charset(text.get_collation_type())->mbmaxlen;
}
length = (length / 2) + (length % 2);
type.set_length(length);
} else { // input is blob or raw type
type.set_length(text.get_length());
}
if (ob_is_string_tc(text.get_type())) {
text.set_calc_type(common::ObRawType);
}