Fix parameterization bug

This commit is contained in:
obdev
2024-02-09 01:16:12 +00:00
committed by ob-robot
parent 1dd7be4b43
commit 470ade36f6

View File

@ -2218,8 +2218,10 @@ int ObSqlParameterization::transform_minus_op(ObIAllocator &alloc, ParseNode *tr
// select 1 - (2/3/4) from dual; // select 1 - (2/3/4) from dual;
// 对于常量节点2,都不能转换成-2 // 对于常量节点2,都不能转换成-2
// do nothing // do nothing
} else if (ob_is_numeric_type(ITEM_TO_OBJ_TYPE(tree->children_[1]->type_)) && } else if (ob_is_number_or_decimal_int_tc(ITEM_TO_OBJ_TYPE(tree->children_[1]->type_))
tree->children_[1]->value_ >= 0) { || ((ob_is_integer_type(ITEM_TO_OBJ_TYPE(tree->children_[1]->type_))
|| ob_is_real_type(ITEM_TO_OBJ_TYPE(tree->children_[1]->type_)))
&& tree->children_[1]->value_ >= 0)) {
ParseNode *child = tree->children_[1]; ParseNode *child = tree->children_[1];
tree->type_ = T_OP_ADD; tree->type_ = T_OP_ADD;
if (!is_from_pl) { if (!is_from_pl) {
@ -2249,8 +2251,7 @@ int ObSqlParameterization::transform_minus_op(ObIAllocator &alloc, ParseNode *tr
} else { } else {
child->is_trans_from_minus_ = 1; child->is_trans_from_minus_ = 1;
} }
} else if (T_OP_MUL == tree->children_[1]->type_ } else if (T_OP_MUL == tree->children_[1]->type_ || T_OP_DIV == tree->children_[1]->type_
|| T_OP_DIV == tree->children_[1]->type_
|| T_OP_INT_DIV == tree->children_[1]->type_ || T_OP_INT_DIV == tree->children_[1]->type_
|| (lib::is_mysql_mode() && T_OP_MOD == tree->children_[1]->type_)) { || (lib::is_mysql_mode() && T_OP_MOD == tree->children_[1]->type_)) {
/* '0 - 2 * 3' should be transformed to '0 + (-2) * 3' */ /* '0 - 2 * 3' should be transformed to '0 + (-2) * 3' */