bugfix: 1. xml_expr: generated_column_expr; 2. extract, extract_value, update_xml: xpath or ns arg not literal

This commit is contained in:
wu-xingying
2023-06-09 08:42:18 +00:00
committed by ob-robot
parent bde662ca8d
commit 64b032db76
4 changed files with 6 additions and 17 deletions

View File

@ -65,8 +65,7 @@ int ObExprExtractValue::calc_result_typeN(ObExprResType &type,
types[i].set_calc_collation_type(CS_TYPE_UTF8MB4_BIN); types[i].set_calc_collation_type(CS_TYPE_UTF8MB4_BIN);
} }
} else { } else {
types[i].set_calc_type(ObVarcharType); ret = OB_ERR_INVALID_XPATH_EXPRESSION;
types[i].set_calc_collation_type(CS_TYPE_UTF8MB4_BIN);
} }
} }
} }
@ -76,7 +75,8 @@ int ObExprExtractValue::calc_result_typeN(ObExprResType &type,
type.set_collation_type(CS_TYPE_UTF8MB4_BIN); type.set_collation_type(CS_TYPE_UTF8MB4_BIN);
type.set_collation_level(CS_LEVEL_IMPLICIT); 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); // length == OB_MAX_VARCHAR_LENGTH_KEY is not supported by generated column length check , use MAX_ORACLE_COMMENT_LENGTH instead
type.set_length(MAX_ORACLE_COMMENT_LENGTH);
type.set_length_semantics(LS_BYTE); type.set_length_semantics(LS_BYTE);
} }
} }

View File

@ -28,7 +28,7 @@ namespace sql
{ {
ObExprExtractXml::ObExprExtractXml(common::ObIAllocator &alloc) ObExprExtractXml::ObExprExtractXml(common::ObIAllocator &alloc)
: ObFuncExprOperator(alloc, T_FUN_SYS_XML_EXTRACT, N_EXTRACT_XML, MORE_THAN_ONE, NOT_VALID_FOR_GENERATED_COL, NOT_ROW_DIMENSION) : ObFuncExprOperator(alloc, T_FUN_SYS_XML_EXTRACT, N_EXTRACT_XML, MORE_THAN_ONE, VALID_FOR_GENERATED_COL, NOT_ROW_DIMENSION)
{ {
} }
@ -64,8 +64,7 @@ int ObExprExtractXml::calc_result_typeN(ObExprResType &type,
types[i].set_calc_collation_type(CS_TYPE_UTF8MB4_BIN); types[i].set_calc_collation_type(CS_TYPE_UTF8MB4_BIN);
} }
} else { } else {
types[i].set_calc_type(ObVarcharType); ret = OB_ERR_INVALID_XPATH_EXPRESSION;
types[i].set_calc_collation_type(CS_TYPE_UTF8MB4_BIN);
} }
} }
} }

View File

@ -62,9 +62,6 @@ int ObExprUpdateXml::calc_result_typeN(ObExprResType &type,
if (types[i].get_charset_type() != CHARSET_UTF8MB4) { if (types[i].get_charset_type() != CHARSET_UTF8MB4) {
types[i].set_calc_collation_type(CS_TYPE_UTF8MB4_BIN); types[i].set_calc_collation_type(CS_TYPE_UTF8MB4_BIN);
} }
} else {
types[i].set_calc_type(ObVarcharType);
types[i].set_calc_collation_type(CS_TYPE_UTF8MB4_BIN);
} }
} else { } else {
// value expr // value expr
@ -86,9 +83,6 @@ int ObExprUpdateXml::calc_result_typeN(ObExprResType &type,
if (types[param_num - 1].get_charset_type() != CHARSET_UTF8MB4) { if (types[param_num - 1].get_charset_type() != CHARSET_UTF8MB4) {
types[param_num - 1].set_calc_collation_type(CS_TYPE_UTF8MB4_BIN); types[param_num - 1].set_calc_collation_type(CS_TYPE_UTF8MB4_BIN);
} }
} else {
types[param_num - 1].set_calc_type(ObVarcharType);
types[param_num - 1].set_calc_collation_type(CS_TYPE_UTF8MB4_BIN);
} }
} }
} }

View File

@ -4441,11 +4441,6 @@ int ObResolverUtils::resolve_generated_column_expr(ObResolverParams &params,
const ObCollationType expr_cs_type = expr->get_result_type().get_collation_type(); const ObCollationType expr_cs_type = expr->get_result_type().get_collation_type();
const ObObjType dst_datatype = generated_column.get_data_type(); const ObObjType dst_datatype = generated_column.get_data_type();
const ObCollationType dst_cs_type = generated_column.get_collation_type(); const ObCollationType dst_cs_type = generated_column.get_collation_type();
if (OB_SUCC(ret) && ObUserDefinedSQLType == expr_datatype) {
ret = OB_ERR_RESULTANT_DATA_TYPE_OF_VIRTUAL_COLUMN_IS_NOT_SUPPORTED;
LOG_WARN("Define a xmltype column in generated column def is not supported", K(ret));
LOG_USER_ERROR(OB_ERR_RESULTANT_DATA_TYPE_OF_VIRTUAL_COLUMN_IS_NOT_SUPPORTED);
}
/* implicit data conversion judgement */ /* implicit data conversion judgement */
if (OB_SUCC(ret) && lib::is_oracle_mode()) { if (OB_SUCC(ret) && lib::is_oracle_mode()) {
@ -4477,6 +4472,7 @@ int ObResolverUtils::resolve_generated_column_expr(ObResolverParams &params,
break; break;
case ObLobType: case ObLobType:
case ObLongTextType: case ObLongTextType:
case ObUserDefinedSQLType:
ret = OB_ERR_RESULTANT_DATA_TYPE_OF_VIRTUAL_COLUMN_IS_NOT_SUPPORTED; ret = OB_ERR_RESULTANT_DATA_TYPE_OF_VIRTUAL_COLUMN_IS_NOT_SUPPORTED;
LOG_WARN("lob data type in generated column definition", K(ret)); LOG_WARN("lob data type in generated column definition", K(ret));
break; break;