fix: create table with select xmlexprs, disable returning object type, disable some xml expr called in pl semantics
This commit is contained in:
@ -44,6 +44,10 @@ int ObExprExtractValue::calc_result_typeN(ObExprResType &type,
|
|||||||
if (OB_UNLIKELY(param_num != 2 && param_num != 3)) {
|
if (OB_UNLIKELY(param_num != 2 && param_num != 3)) {
|
||||||
ret = OB_ERR_PARAM_SIZE;
|
ret = OB_ERR_PARAM_SIZE;
|
||||||
LOG_WARN("invalid argument number", K(ret), K(param_num));
|
LOG_WARN("invalid argument number", K(ret), K(param_num));
|
||||||
|
} else if (!is_called_in_sql()) {
|
||||||
|
ret = OB_ERR_SP_LILABEL_MISMATCH;
|
||||||
|
LOG_WARN("expr call in pl semantics disallowed", K(ret), K(N_EXTRACTVALUE));
|
||||||
|
LOG_USER_ERROR(OB_ERR_SP_LILABEL_MISMATCH, static_cast<int>(strlen(N_EXTRACTVALUE)), N_EXTRACTVALUE);
|
||||||
} else {
|
} else {
|
||||||
ObObjType in_type = types[0].get_type();
|
ObObjType in_type = types[0].get_type();
|
||||||
if (types[0].is_ext() && types[0].get_udt_id() == T_OBJ_XML) {
|
if (types[0].is_ext() && types[0].get_udt_id() == T_OBJ_XML) {
|
||||||
@ -70,6 +74,7 @@ int ObExprExtractValue::calc_result_typeN(ObExprResType &type,
|
|||||||
if (OB_SUCC(ret)) {
|
if (OB_SUCC(ret)) {
|
||||||
type.set_type(ObVarcharType);
|
type.set_type(ObVarcharType);
|
||||||
type.set_collation_type(CS_TYPE_UTF8MB4_BIN);
|
type.set_collation_type(CS_TYPE_UTF8MB4_BIN);
|
||||||
|
type.set_collation_level(CS_LEVEL_IMPLICIT);
|
||||||
// length == OB_MAX_ORACLE_VARCHAR_LENGTH is not supported by generated key, use OB_MAX_VARCHAR_LENGTH_KEY instead
|
// length == OB_MAX_ORACLE_VARCHAR_LENGTH is not supported by generated key, use OB_MAX_VARCHAR_LENGTH_KEY instead
|
||||||
type.set_length(OB_MAX_VARCHAR_LENGTH_KEY);
|
type.set_length(OB_MAX_VARCHAR_LENGTH_KEY);
|
||||||
type.set_length_semantics(LS_BYTE);
|
type.set_length_semantics(LS_BYTE);
|
||||||
|
|||||||
@ -43,6 +43,10 @@ int ObExprExtractXml::calc_result_typeN(ObExprResType &type,
|
|||||||
if (OB_UNLIKELY(param_num != 3)) {
|
if (OB_UNLIKELY(param_num != 3)) {
|
||||||
ret = OB_ERR_PARAM_SIZE;
|
ret = OB_ERR_PARAM_SIZE;
|
||||||
LOG_WARN("invalid argument number", K(ret), K(param_num));
|
LOG_WARN("invalid argument number", K(ret), K(param_num));
|
||||||
|
} else if (!is_called_in_sql()) {
|
||||||
|
ret = OB_ERR_SP_LILABEL_MISMATCH;
|
||||||
|
LOG_WARN("expr call in pl semantics disallowed", K(ret), K(N_EXTRACT_XML));
|
||||||
|
LOG_USER_ERROR(OB_ERR_SP_LILABEL_MISMATCH, static_cast<int>(strlen(N_EXTRACT_XML)), N_EXTRACT_XML);
|
||||||
} else {
|
} else {
|
||||||
ObObjType in_type = types[0].get_type();
|
ObObjType in_type = types[0].get_type();
|
||||||
if (types[0].is_ext() && types[0].get_udt_id() == T_OBJ_XML) {
|
if (types[0].is_ext() && types[0].get_udt_id() == T_OBJ_XML) {
|
||||||
|
|||||||
@ -42,6 +42,10 @@ int ObExprSysMakeXML::calc_result_typeN(ObExprResType& type,
|
|||||||
if (OB_UNLIKELY(param_num < 1 || param_num == 3 || param_num > 4)) {
|
if (OB_UNLIKELY(param_num < 1 || param_num == 3 || param_num > 4)) {
|
||||||
ret = OB_ERR_PARAM_SIZE;
|
ret = OB_ERR_PARAM_SIZE;
|
||||||
LOG_WARN("invalid argument number", K(ret), K(param_num));
|
LOG_WARN("invalid argument number", K(ret), K(param_num));
|
||||||
|
} else if (!is_called_in_sql()) {
|
||||||
|
ret = OB_ERR_SP_LILABEL_MISMATCH;
|
||||||
|
LOG_WARN("expr call in pl semantics disallowed", K(ret), K(N_SYS_MAKEXML));
|
||||||
|
LOG_USER_ERROR(OB_ERR_SP_LILABEL_MISMATCH, static_cast<int>(strlen(N_SYS_MAKEXML)), N_SYS_MAKEXML);
|
||||||
} else if (param_num == 1) {
|
} else if (param_num == 1) {
|
||||||
// 1st param is blob
|
// 1st param is blob
|
||||||
// oracle will rewrite the query to sys_makexml(0, ...), but there is no need to compat it.
|
// oracle will rewrite the query to sys_makexml(0, ...), but there is no need to compat it.
|
||||||
|
|||||||
@ -43,6 +43,10 @@ int ObExprXmlSerialize::calc_result_typeN(ObExprResType& type,
|
|||||||
if (OB_UNLIKELY(param_num != 10)) {
|
if (OB_UNLIKELY(param_num != 10)) {
|
||||||
ret = OB_ERR_PARAM_SIZE;
|
ret = OB_ERR_PARAM_SIZE;
|
||||||
LOG_WARN("invalid param number", K(ret), K(param_num));
|
LOG_WARN("invalid param number", K(ret), K(param_num));
|
||||||
|
} else if (!is_called_in_sql()) {
|
||||||
|
ret = OB_ERR_SP_LILABEL_MISMATCH;
|
||||||
|
LOG_WARN("expr call in pl semantics disallowed", K(ret), K(N_XMLSERIALIZE));
|
||||||
|
LOG_USER_ERROR(OB_ERR_SP_LILABEL_MISMATCH, static_cast<int>(strlen(N_XMLSERIALIZE)), N_XMLSERIALIZE);
|
||||||
} else {
|
} else {
|
||||||
if (!ob_is_integer_type(types[0].get_type())) {
|
if (!ob_is_integer_type(types[0].get_type())) {
|
||||||
ret = OB_ERR_UNEXPECTED;
|
ret = OB_ERR_UNEXPECTED;
|
||||||
@ -72,6 +76,7 @@ int ObExprXmlSerialize::calc_result_typeN(ObExprResType& type,
|
|||||||
} else {
|
} else {
|
||||||
type.set_collation_type(dst_type.get_collation_type());
|
type.set_collation_type(dst_type.get_collation_type());
|
||||||
}
|
}
|
||||||
|
type.set_collation_level(CS_LEVEL_IMPLICIT);
|
||||||
type.set_full_length(dst_type.get_length(), dst_type.get_length_semantics());
|
type.set_full_length(dst_type.get_length(), dst_type.get_length_semantics());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -43,7 +43,11 @@ int ObExprXmlcast::calc_result_type2(ObExprResType &type,
|
|||||||
int ret = OB_SUCCESS;
|
int ret = OB_SUCCESS;
|
||||||
ObObjType xml_type = type1.get_type();
|
ObObjType xml_type = type1.get_type();
|
||||||
uint64_t subschema_id = type1.get_subschema_id();
|
uint64_t subschema_id = type1.get_subschema_id();
|
||||||
if (type1.is_ext() && type1.get_udt_id() == T_OBJ_XML) {
|
if (!is_called_in_sql()) {
|
||||||
|
ret = OB_ERR_SP_LILABEL_MISMATCH;
|
||||||
|
LOG_WARN("expr call in pl semantics disallowed", K(ret), K(N_XMLCAST));
|
||||||
|
LOG_USER_ERROR(OB_ERR_SP_LILABEL_MISMATCH, static_cast<int>(strlen(N_XMLCAST)), N_XMLCAST);
|
||||||
|
} else if (type1.is_ext() && type1.get_udt_id() == T_OBJ_XML) {
|
||||||
type1.get_calc_meta().set_sql_udt(ObXMLSqlType);
|
type1.get_calc_meta().set_sql_udt(ObXMLSqlType);
|
||||||
} else if (!ob_is_xml_sql_type(xml_type, subschema_id)) {
|
} else if (!ob_is_xml_sql_type(xml_type, subschema_id)) {
|
||||||
ret = OB_ERR_INVALID_TYPE_FOR_OP;
|
ret = OB_ERR_INVALID_TYPE_FOR_OP;
|
||||||
@ -86,6 +90,9 @@ int ObExprXmlcast::set_dest_type(ObExprResType ¶m_type, ObExprResType &dst_t
|
|||||||
dst_type.set_collation_type(ob_is_nstring_type(dst_type.get_type()) ?
|
dst_type.set_collation_type(ob_is_nstring_type(dst_type.get_type()) ?
|
||||||
collation_nation : collation_connection);
|
collation_nation : collation_connection);
|
||||||
}
|
}
|
||||||
|
if (ob_is_string_or_lob_type(obj_type)) {
|
||||||
|
dst_type.set_collation_level(CS_LEVEL_IMPLICIT);
|
||||||
|
}
|
||||||
// set accuracy
|
// set accuracy
|
||||||
if (ObStringTC == dest_tc) {
|
if (ObStringTC == dest_tc) {
|
||||||
// parser will abort all negative number
|
// parser will abort all negative number
|
||||||
|
|||||||
@ -1460,6 +1460,9 @@ int ObDelUpdResolver::resolve_returning(const ParseNode *parse_tree)
|
|||||||
expr = lob_expr;
|
expr = lob_expr;
|
||||||
LOG_DEBUG("build returning lob expr", KPC(expr), KPC(ref_expr), KPC(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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user