fix case when, returning with xmltype incompatible

This commit is contained in:
obdev 2023-05-15 08:21:48 +00:00 committed by ob-robot
parent be9397596c
commit 64df4d7271
4 changed files with 22 additions and 12 deletions

View File

@ -1372,7 +1372,9 @@ inline bool ob_is_geometry(const ObObjType type) { return ObGeometryType == type
inline bool ob_is_user_defined_sql_type(const ObObjType type) { return ObUserDefinedSQLType == type; }
inline bool ob_is_user_defined_pl_type(const ObObjType type) { return ObExtendType == type; }
inline bool ob_is_user_defined_type(const ObObjType type) {
return ob_is_user_defined_sql_type(type) || ob_is_user_defined_pl_type(type);
}
// xml type without schema
inline bool ob_is_xml_sql_type(const ObObjType type, const uint16_t sub_schema_id) {
return (ObUserDefinedSQLType == type) && (sub_schema_id == ObXMLSqlType);

View File

@ -1400,7 +1400,7 @@ static ObObjType MERGE_RESULT_TYPE[ObMaxType][ObMaxType] = {
ObMaxType, /*ExtendType=>ObLobType*/
ObMaxType, /*ExtendType=>ObJsonType*/
ObGeometryType, /*ExtendType=>ObGeometryType*/
ObMaxType, /*ExtendType=>ObUserDefinedSQLType*/
ObUserDefinedSQLType, /*ExtendType=>ObUserDefinedSQLType*/
},
/*UnknownType*/
@ -2626,7 +2626,7 @@ static ObObjType MERGE_RESULT_TYPE[ObMaxType][ObMaxType] = {
},
/*ObUserDefinedSQLType*/
{
ObLobType, /* ObUserDefinedSQLType=>NullType */
ObUserDefinedSQLType, /* ObUserDefinedSQLType=>NullType */
ObMaxType, /* ObUserDefinedSQLType=>TinyIntType */
ObMaxType, /* ObUserDefinedSQLType=>SmallIntType */
ObMaxType, /* ObUserDefinedSQLType=>MediumIntType */
@ -2651,7 +2651,7 @@ static ObObjType MERGE_RESULT_TYPE[ObMaxType][ObMaxType] = {
ObMaxType, /* ObUserDefinedSQLType=>VarcharType */
ObMaxType, /* ObUserDefinedSQLType=>CharType */
ObMaxType, /* ObUserDefinedSQLType=>HexStringType */
ObMaxType, /* ObUserDefinedSQLType=>ExtendType */
ObUserDefinedSQLType, /* ObUserDefinedSQLType=>ExtendType */
ObMaxType, /* ObUserDefinedSQLType=>UnknownType */
ObMaxType, /* ObUserDefinedSQLType=>ObTinyTextType */
ObMaxType, /* ObUserDefinedSQLType=>ObTextType */

View File

@ -1017,8 +1017,8 @@ int ObExprOperator::is_same_kind_type_for_case(const ObExprResType &type1, const
match = (type1.get_accuracy() == type2.get_accuracy());
} else if (ob_is_json(type1.get_type())) {
match = ob_is_json(type2.get_type());
} else if (type1.is_xml_sql_type()) {
match = type2.is_xml_sql_type();
} else if (type1.is_xml_sql_type() || (type1.is_ext() && type1.get_udt_id() == T_OBJ_XML)) {
match = type2.is_xml_sql_type() || (type2.is_ext() && type2.get_udt_id() == T_OBJ_XML);
}
}
return ret;
@ -1453,6 +1453,7 @@ int ObExprOperator::aggregate_extend_accuracy_for_merge(ObExprResType &type,
for (int64_t i = 0; !find_extend && i < param_num && OB_SUCC(ret); ++i) {
if (ob_is_extend(types[i].get_type())) {
find_extend = true;
type.set_extend_type(types[i].get_extend_type());
type.set_accuracy(types[i].get_accuracy().get_accuracy());
}
}
@ -1984,9 +1985,15 @@ 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()
&& (type1.is_user_defined_sql_type() || type2.is_user_defined_sql_type())
&& (type_ >= T_OP_EQ && type_ <= T_OP_NE)) {
ret = OB_ERR_INVALID_XML_DATATYPE;
&& (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)) {
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
} else {
ret = OB_ERR_INVALID_XML_DATATYPE;
}
LOG_WARN("incorrect cmp type with xml arguments", K(type1), K(type2), K(type_), K(ret));
} else if (OB_FAIL(ObExprResultTypeUtil::get_relational_cmp_type(cmp_type,
type1.get_type(),

View File

@ -1460,11 +1460,12 @@ int ObDelUpdResolver::resolve_returning(const ParseNode *parse_tree)
expr = lob_expr;
LOG_DEBUG("build returning lob expr", KPC(expr), KPC(ref_expr), KPC(lob_expr));
}
} else if (ObObjType::ObUserDefinedSQLType == ref_expr->get_data_type()) {
ret = OB_ERR_RETURNING_CLAUSE;
LOG_WARN("RETURNING clause is currently not supported for object type columns", K(ret));
}
}
if (OB_SUCC(ret) && ob_is_user_defined_type(expr->get_data_type())) {
ret = OB_ERR_RETURNING_CLAUSE;
LOG_WARN("RETURNING clause is currently not supported for object type", K(ret));
}
if (OB_SUCC(ret)) {
ObString expr_name;