[to #52577309] fix(expr): prohibit AND operands of EXTEND type from being implicitly converted to BOOL

This commit is contained in:
haohao022
2023-11-15 11:49:05 +00:00
committed by ob-robot
parent c8ace58297
commit 5709e47459

View File

@ -36,12 +36,24 @@ int ObExprAnd::calc_result_typeN(ObExprResType &type,
ObExprTypeCtx &type_ctx) const
{
UNUSED(type_ctx);
UNUSED(types_stack);
UNUSED(param_num);
int ret = OB_SUCCESS;
if (OB_ISNULL(types_stack)) {
ret = OB_INVALID_ARGUMENT;
LOG_WARN("null types", K(ret));
} else {
for (int64_t i = 0; OB_SUCC(ret) && i < param_num; i++) {
if (types_stack[i].is_ext()) {
ret = OB_ERR_EXPRESSION_WRONG_TYPE;
LOG_WARN("PLS-00382: expression is of wrong type", K(ret), K(types_stack[i].get_type()));
}
}
}
if (OB_SUCC(ret)) {
type.set_type(ObInt32Type);
type.set_precision(DEFAULT_PRECISION_FOR_BOOL);
type.set_scale(DEFAULT_SCALE_FOR_INTEGER);
}
return ret;
}