[CP] [to #55654538]fix bug trigger resolve core
This commit is contained in:
parent
4cb79d3efd
commit
348df7f4f8
@ -169,13 +169,20 @@ int ObPLResolver::init_default_expr(ObPLFunctionAST &func_ast,
|
|||||||
const ParseNode *default_node = NULL;
|
const ParseNode *default_node = NULL;
|
||||||
ObRawExpr *default_expr = NULL;
|
ObRawExpr *default_expr = NULL;
|
||||||
ObString default_value = param.get_default_value();
|
ObString default_value = param.get_default_value();
|
||||||
|
bool is_for_trigger = false;
|
||||||
|
if (resolve_ctx_.session_info_.is_for_trigger_package()
|
||||||
|
&& lib::is_oracle_mode()
|
||||||
|
&& ObTriggerInfo::is_trigger_body_package_id(func_ast.get_package_id())) {
|
||||||
|
is_for_trigger = true;
|
||||||
|
}
|
||||||
OZ (ObSQLUtils::convert_sql_text_from_schema_for_resolve(
|
OZ (ObSQLUtils::convert_sql_text_from_schema_for_resolve(
|
||||||
resolve_ctx_.allocator_, resolve_ctx_.session_info_.get_dtc_params(), default_value));
|
resolve_ctx_.allocator_, resolve_ctx_.session_info_.get_dtc_params(), default_value));
|
||||||
OZ (ObRawExprUtils::parse_default_expr_from_str(
|
OZ (ObRawExprUtils::parse_default_expr_from_str(
|
||||||
default_value,
|
default_value,
|
||||||
resolve_ctx_.session_info_.get_charsets4parser(),
|
resolve_ctx_.session_info_.get_charsets4parser(),
|
||||||
resolve_ctx_.allocator_,
|
resolve_ctx_.allocator_,
|
||||||
default_node));
|
default_node,
|
||||||
|
is_for_trigger));
|
||||||
CK (OB_NOT_NULL(default_node));
|
CK (OB_NOT_NULL(default_node));
|
||||||
OZ (resolve_expr(default_node, func_ast, default_expr,
|
OZ (resolve_expr(default_node, func_ast, default_expr,
|
||||||
combine_line_and_col(default_node->stmt_loc_), true, &expected_type));
|
combine_line_and_col(default_node->stmt_loc_), true, &expected_type));
|
||||||
|
@ -1487,7 +1487,8 @@ int ObRawExprUtils::make_raw_expr_from_str(const ObString &expr_str,
|
|||||||
}
|
}
|
||||||
|
|
||||||
int ObRawExprUtils::parse_default_expr_from_str(const ObString &expr_str,
|
int ObRawExprUtils::parse_default_expr_from_str(const ObString &expr_str,
|
||||||
ObCharsets4Parser expr_str_cs_type, ObIAllocator &allocator, const ParseNode *&node)
|
ObCharsets4Parser expr_str_cs_type, ObIAllocator &allocator, const ParseNode *&node,
|
||||||
|
bool is_for_trigger)
|
||||||
{
|
{
|
||||||
int ret = OB_SUCCESS;
|
int ret = OB_SUCCESS;
|
||||||
ObSqlString sql_str;
|
ObSqlString sql_str;
|
||||||
@ -1509,6 +1510,7 @@ int ObRawExprUtils::parse_default_expr_from_str(const ObString &expr_str,
|
|||||||
(ObCharset::charset_type_by_coll(expr_str_cs_type.string_collation_) != CHARSET_UTF8MB4) : false;
|
(ObCharset::charset_type_by_coll(expr_str_cs_type.string_collation_) != CHARSET_UTF8MB4) : false;
|
||||||
parse_result.connection_collation_ = expr_str_cs_type.string_collation_;
|
parse_result.connection_collation_ = expr_str_cs_type.string_collation_;
|
||||||
parse_result.semicolon_start_col_ = INT32_MAX;
|
parse_result.semicolon_start_col_ = INT32_MAX;
|
||||||
|
parse_result.is_for_trigger_ = is_for_trigger;
|
||||||
if (OB_FAIL(sql_str.append_fmt("DO %.*s", expr_str.length(), expr_str.ptr()))) {
|
if (OB_FAIL(sql_str.append_fmt("DO %.*s", expr_str.length(), expr_str.ptr()))) {
|
||||||
LOG_WARN("failed to concat expr str", K(expr_str), K(ret));
|
LOG_WARN("failed to concat expr str", K(expr_str), K(ret));
|
||||||
} else if (OB_FAIL(parser.parse(
|
} else if (OB_FAIL(parser.parse(
|
||||||
|
@ -217,7 +217,8 @@ public:
|
|||||||
static int parse_default_expr_from_str(const common::ObString &expr_str,
|
static int parse_default_expr_from_str(const common::ObString &expr_str,
|
||||||
ObCharsets4Parser expr_str_cs_type,
|
ObCharsets4Parser expr_str_cs_type,
|
||||||
common::ObIAllocator &allocator,
|
common::ObIAllocator &allocator,
|
||||||
const ParseNode *&node);
|
const ParseNode *&node,
|
||||||
|
bool is_for_trigger = false);
|
||||||
static int parse_expr_list_node_from_str(const common::ObString &expr_str,
|
static int parse_expr_list_node_from_str(const common::ObString &expr_str,
|
||||||
ObCharsets4Parser expr_str_cs_type,
|
ObCharsets4Parser expr_str_cs_type,
|
||||||
common::ObIAllocator &allocator,
|
common::ObIAllocator &allocator,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user