Fix like '\' bug

This commit is contained in:
2149
2023-10-20 03:13:25 +00:00
committed by ob-robot
parent 5528cd45b6
commit 4ebc347f35
2 changed files with 6 additions and 2 deletions

View File

@ -4312,7 +4312,8 @@ int ObPreCalcExprConstraint::check_is_match(const ObObjParam &obj_param, bool &i
is_match = false;
} else if (!pattern_val.empty()) {
is_match = OB_ISNULL(pattern_val.find('%')) &&
OB_ISNULL(pattern_val.find('_'));
OB_ISNULL(pattern_val.find('_')) &&
OB_ISNULL(pattern_val.find('\\'));
} else {
is_match = true;
}

View File

@ -733,8 +733,11 @@ int ObTransformSimplifyExpr::do_check_like_condition(ObRawExpr *&expr,
*ctx_->allocator_))) {
LOG_WARN("failed to calc const or calculable expr", K(ret));
} else if (got_result) {
//can't replace if pattern have wildcard or default escape character
ObString val = result.get_string();
can_replace = OB_ISNULL(val.find('_')) && OB_ISNULL(val.find('%'));
can_replace = OB_ISNULL(val.find('_'))
&& OB_ISNULL(val.find('%'))
&& OB_ISNULL(val.find('\\'));
} else {}
}
if (OB_SUCC(ret) && can_replace) {