diff --git a/src/sql/engine/expr/ob_expr_operator.cpp b/src/sql/engine/expr/ob_expr_operator.cpp index e462671663..b43f76dc4f 100644 --- a/src/sql/engine/expr/ob_expr_operator.cpp +++ b/src/sql/engine/expr/ob_expr_operator.cpp @@ -1985,9 +1985,8 @@ int ObExprOperator::calc_cmp_type2(ObExprResType &type, ret = OB_ERR_INVALID_CMP_OP; LOG_WARN("incorrect cmp type with json arguments", K(type1), K(type2), K(type_), K(ret)); } else if (is_oracle_mode() - && (ob_is_user_defined_type(type1.get_type()) - || ob_is_user_defined_type(type2.get_type())) - && ((type_ >= T_OP_EQ && type_ <= T_OP_NE) || type_ == T_FUN_SYS_NULLIF)) { + && (ob_is_user_defined_type(type1.get_type()) || ob_is_user_defined_type(type2.get_type()))) { + // udt tyes not implemented in ORACLE_RELATIONAL_CMP_TYPE curretly if ((ob_is_user_defined_type(type1.get_type()) && ob_is_user_defined_type(type2.get_type())) || (type1.is_null() || type2.is_null())) { ret = OB_ERR_NO_ORDER_MAP_SQL; // oracle error code compability diff --git a/src/sql/engine/expr/ob_expr_oracle_nullif.cpp b/src/sql/engine/expr/ob_expr_oracle_nullif.cpp index d4340da4f9..a9c3120122 100644 --- a/src/sql/engine/expr/ob_expr_oracle_nullif.cpp +++ b/src/sql/engine/expr/ob_expr_oracle_nullif.cpp @@ -134,7 +134,9 @@ bool ObExprOracleNullif::is_same_type(const ObExprResType &type1, if (oracleType1 == oracleType2 || is_numberic_type(oracleType1, oracleType2) || is_string_type(oracleType1, oracleType2) || - is_time_type(oracleType1, oracleType2)) { + is_time_type(oracleType1, oracleType2) || + ((oracleType1 == ObOExtendType || oracleType1 == ObOUDTSqlType) + && (oracleType2 == ObOExtendType || oracleType2 == ObOUDTSqlType))) { ret = true; } diff --git a/src/sql/resolver/dml/ob_del_upd_resolver.cpp b/src/sql/resolver/dml/ob_del_upd_resolver.cpp index 805a57ad5c..3003269a76 100644 --- a/src/sql/resolver/dml/ob_del_upd_resolver.cpp +++ b/src/sql/resolver/dml/ob_del_upd_resolver.cpp @@ -1462,9 +1462,15 @@ int ObDelUpdResolver::resolve_returning(const ParseNode *parse_tree) } } } - if (OB_SUCC(ret) && ob_is_user_defined_type(expr->get_data_type())) { + if (OB_SUCC(ret) + && (ob_is_user_defined_sql_type(expr->get_data_type()) + || ob_is_xml_pl_type(expr->get_data_type(), expr->get_udt_id()))) { + // ORA-22816 returning clause is currently not object type columns + // but this is success in ORA: execute immediate 'insert into t1 values(4,5) returning udt1(c1, c2) into :a' using out a; + // xmltype is not allowed: execute immediate 'insert into t2 values(:b) returning xmltype(c1) into :a' using b, out a; ret = OB_ERR_RETURNING_CLAUSE; - LOG_WARN("RETURNING clause is currently not supported for object type", K(ret)); + LOG_WARN("RETURNING clause is currently not supported for object type", + K(ret), K(expr->get_data_type())); } if (OB_SUCC(ret)) { diff --git a/src/sql/resolver/dml/ob_dml_resolver.cpp b/src/sql/resolver/dml/ob_dml_resolver.cpp index 86b8658992..03bafc02a1 100755 --- a/src/sql/resolver/dml/ob_dml_resolver.cpp +++ b/src/sql/resolver/dml/ob_dml_resolver.cpp @@ -1356,6 +1356,9 @@ int ObDMLResolver::implict_cast_pl_udt_to_sql_udt(ObRawExpr* &real_ref_expr) if (OB_ISNULL(real_ref_expr)) { ret = OB_ERR_UNEXPECTED; LOG_WARN("real_ref_expr is null", K(ret)); + } else if (real_ref_expr->get_result_type().get_type() >= ObMaxType + && OB_FAIL(real_ref_expr->formalize(session_info_))) { + LOG_WARN("failed to do formalize", K(ret), K(real_ref_expr)); } else if (real_ref_expr->get_result_type().is_ext()) { if (real_ref_expr->get_result_type().get_udt_id() == T_OBJ_XML) { // add implicit cast to sql xmltype @@ -1453,13 +1456,13 @@ int ObDMLResolver::check_column_udt_type(ParseNode *root_node) } } if (pos_col < 0) { // not found - ret = OB_INVALID_ARGUMENT; - LOG_WARN("get invalid table name", K(ret), K(tab_str), K(tab_has_alias)); + ret = OB_ERR_BAD_FIELD_ERROR; + LOG_WARN("get invalid identifier name", K(ret), K(tab_str), K(col_str), K(tab_has_alias)); } else { ObColumnRefRawExpr* col_expr = the_col_item.get_expr(); if (OB_ISNULL(col_expr)) { - ret = OB_INVALID_ARGUMENT; - LOG_WARN("get invalid table name", K(ret), K(tab_str), K(tab_has_alias)); + ret = OB_ERR_BAD_FIELD_ERROR; + LOG_WARN("get invalid identifier name", K(ret), K(tab_str), K(col_str), K(tab_has_alias)); } else if (!col_expr->get_result_type().is_user_defined_sql_type()) { ret = OB_ERR_NOT_OBJ_REF; }