diff --git a/src/pl/ob_pl.cpp b/src/pl/ob_pl.cpp index b509483515..245d98272e 100644 --- a/src/pl/ob_pl.cpp +++ b/src/pl/ob_pl.cpp @@ -3336,11 +3336,12 @@ int ObPLExecState::init(const ParamStore *params, bool is_anonymous) OZ(func_.get_frame_info().pre_alloc_exec_memory(*ctx_.exec_ctx_, ctx_.allocator_)); } + // init params may use exec stack, need append to pl context first + CK (OB_NOT_NULL(top_context_ = ctx_.exec_ctx_->get_my_session()->get_pl_context())); + OZ (top_context_->get_exec_stack().push_back(this)); OZ (init_params(params, is_anonymous)); - CK (OB_NOT_NULL(top_context_ = ctx_.exec_ctx_->get_my_session()->get_pl_context())); - OZ (top_context_->get_exec_stack().push_back(this)); OX (top_context_->set_has_output_arguments(!func_.get_out_args().is_empty())); if (OB_SUCC(ret)) { diff --git a/src/sql/engine/expr/ob_expr_object_construct.cpp b/src/sql/engine/expr/ob_expr_object_construct.cpp index a03b9d3ced..7a311e5253 100644 --- a/src/sql/engine/expr/ob_expr_object_construct.cpp +++ b/src/sql/engine/expr/ob_expr_object_construct.cpp @@ -138,6 +138,7 @@ int ObExprObjectConstruct::newx(ObEvalCtx &ctx, ObObj &result, uint64_t udt_id) int64_t init_size = OB_INVALID_SIZE; ObArenaAllocator tmp_alloc; const pl::ObUserDefinedType *user_type = NULL; + CK (OB_NOT_NULL(ns)); OZ (ns->get_user_type(udt_id, user_type, &tmp_alloc)); CK (OB_NOT_NULL(user_type)); OZ (user_type->newx(alloc, ns, ptr));