From ced1abdc782c35e1308bded9b5de52453428019d Mon Sep 17 00:00:00 2001 From: obdev Date: Mon, 24 Apr 2023 03:41:03 +0000 Subject: [PATCH] [to #49178989] fix mysqltest --- deps/easy/src/io/easy_negotiation.c | 18 +++++++++--------- src/pl/ob_pl_resolver.cpp | 1 + src/pl/ob_pl_user_type.h | 2 +- .../engine/expr/ob_expr_object_construct.cpp | 18 ++++++++++++++---- src/sql/resolver/ob_resolver_utils.cpp | 1 + 5 files changed, 26 insertions(+), 14 deletions(-) diff --git a/deps/easy/src/io/easy_negotiation.c b/deps/easy/src/io/easy_negotiation.c index f95ad21c9..b98c39fd9 100644 --- a/deps/easy/src/io/easy_negotiation.c +++ b/deps/easy/src/io/easy_negotiation.c @@ -76,9 +76,9 @@ static int easy_encode_uint16(char *buf, const uint64_t buf_len, int64_t *pos, u static int easy_decode_uint64(char *buf, const int64_t data_len, int64_t *pos, uint64_t *val) { int ret = (NULL != buf && data_len - *pos >= 8) ? EASY_OK : EASY_ERROR; - - if (EASY_OK == ret) { - *val = (((uint64_t)((*(buf + (*pos)++))) & 0xff)) << 56; + + if (EASY_OK == ret) { + *val = (((uint64_t)((*(buf + (*pos)++))) & 0xff)) << 56; *val |= (((uint64_t)((*(buf + (*pos)++))) & 0xff)) << 48; *val |= (((uint64_t)((*(buf + (*pos)++))) & 0xff)) << 40; *val |= (((uint64_t)((*(buf + (*pos)++))) & 0xff)) << 32; @@ -152,9 +152,9 @@ static int easy_decode_negotiation_msg(easy_negotiation_msg_t *ne_msg, char *rec easy_info_log("easy decode header magic failed!ret:%d.", ret); return ret; } - - ret = easy_decode_uint16(recv_buf, recv_buf_len, &pos, &(ne_msg->msg_header.msg_body_len)); - if (ret != EASY_OK) { + + ret = easy_decode_uint16(recv_buf, recv_buf_len, &pos, &(ne_msg->msg_header.msg_body_len)); + if (ret != EASY_OK) { easy_info_log("decode msg body len failed!ret:%d.", ret); return ret; } @@ -288,9 +288,9 @@ int easy_send_negotiate_message(easy_connection_t *c) eio->magic, ioth->idx, &conn_has_error)) == EASY_OK) { - c->is_negotiated = 1; - } - if (conn_has_error) { + c->is_negotiated = 1; + } + if (conn_has_error) { c->conn_has_error = conn_has_error; } return ret; diff --git a/src/pl/ob_pl_resolver.cpp b/src/pl/ob_pl_resolver.cpp index 11a0a13ae..68879d637 100644 --- a/src/pl/ob_pl_resolver.cpp +++ b/src/pl/ob_pl_resolver.cpp @@ -8901,6 +8901,7 @@ int ObPLResolver::resolve_inner_call( if (OB_SUCC(ret) && (expr_params.count() > 0 || obj_access_idents.at(i).has_brackets_) && !access_idxs.at(idx_cnt).is_procedure() + && !access_idxs.at(idx_cnt).is_udf_type() && !access_idxs.at(idx_cnt).is_system_procedure() && !access_idxs.at(idx_cnt).is_type_method() && (!access_idxs.at(idx_cnt).var_type_.is_composite_type() || 0 == expr_params.count())) { diff --git a/src/pl/ob_pl_user_type.h b/src/pl/ob_pl_user_type.h index afe30180e..85fd82433 100644 --- a/src/pl/ob_pl_user_type.h +++ b/src/pl/ob_pl_user_type.h @@ -553,7 +553,7 @@ public: int deserialize(const char* buf, const int64_t len, int64_t &pos); void print() const; - TO_STRING_KV(K_(type)); + TO_STRING_KV(K_(type), K_(id), K_(is_null)); protected: ObPLType type_; diff --git a/src/sql/engine/expr/ob_expr_object_construct.cpp b/src/sql/engine/expr/ob_expr_object_construct.cpp index d18bfaf10..f2b14a4c9 100644 --- a/src/sql/engine/expr/ob_expr_object_construct.cpp +++ b/src/sql/engine/expr/ob_expr_object_construct.cpp @@ -48,9 +48,16 @@ int ObExprObjectConstruct::calc_result_typeN(ObExprResType &type, UNUSED (type_ctx); CK (param_num == elem_types_.count()); for (int64_t i = 0; OB_SUCC(ret) && i < param_num; i++) { - types[i].set_calc_accuracy(elem_types_.at(i).get_accuracy()); - types[i].set_calc_meta(elem_types_.at(i).get_obj_meta()); - types[i].set_calc_type(elem_types_.at(i).get_type()); + if ((ObExtendType == elem_types_.at(i).get_type() + && types[i].get_type() != ObExtendType && types[i].get_type() != ObNullType) + ||(ObExtendType == types[i].get_type() && elem_types_.at(i).get_type() != ObExtendType)) { + ret = OB_ERR_CALL_WRONG_ARG; + LOG_WARN("PLS-00306: wrong number or types of arguments in call", K(ret)); + } else { + types[i].set_calc_accuracy(elem_types_.at(i).get_accuracy()); + types[i].set_calc_meta(elem_types_.at(i).get_obj_meta()); + types[i].set_calc_type(elem_types_.at(i).get_type()); + } } OX (type.set_type(ObExtendType)); OX (type.set_udt_id(udt_id_)); @@ -67,7 +74,10 @@ int ObExprObjectConstruct::check_types(const ObObj *objs_stack, for (int64_t i = 0; OB_SUCC(ret) && i < param_num; i++) { if (!objs_stack[i].is_null()) { TYPE_CHECK(objs_stack[i], elem_types.at(i).get_type()); - if (objs_stack[i].is_pl_extend()) { + if (objs_stack[i].is_pl_extend() + && objs_stack[i].get_meta().get_extend_type() != pl::PL_OPAQUE_TYPE + && objs_stack[i].get_meta().get_extend_type() != pl::PL_CURSOR_TYPE + && objs_stack[i].get_meta().get_extend_type() != pl::PL_REF_CURSOR_TYPE) { pl::ObPLComposite *composite = reinterpret_cast(objs_stack[i].get_ext()); CK (OB_NOT_NULL(composite)); if (OB_SUCC(ret) && composite->get_id() != elem_types.at(i).get_udt_id()) { diff --git a/src/sql/resolver/ob_resolver_utils.cpp b/src/sql/resolver/ob_resolver_utils.cpp index ac19853d2..88e7b2b5a 100644 --- a/src/sql/resolver/ob_resolver_utils.cpp +++ b/src/sql/resolver/ob_resolver_utils.cpp @@ -944,6 +944,7 @@ int ObResolverUtils::check_match(const pl::ObPLResolveCtx &resolve_ctx, // 如果在相同的位置已经进行过匹配, 说明给定的参数在参数列表中出现了两次 if (OB_SUCC(ret) && (OB_INVALID_ID == position + || position >= match_info.match_info_.count() || ObMaxType != match_info.match_info_.at(position).dest_type_)) { ret = OB_ERR_SP_WRONG_ARG_NUM; LOG_WARN("argument count not match",