disable creating materialized view on xmltype columns
This commit is contained in:
		| @ -1487,7 +1487,9 @@ int ObDDLService::generate_schema( | |||||||
| 
 | 
 | ||||||
|   if (OB_SUCC(ret)) { |   if (OB_SUCC(ret)) { | ||||||
|     if (schema.is_materialized_view()) { |     if (schema.is_materialized_view()) { | ||||||
|       if (arg.mv_ainfo_.count() <= 0) { |       if (OB_FAIL(ObResolverUtils::check_schema_valid_for_mview(schema))) { | ||||||
|  |         LOG_WARN("failed to check schema valid for mview", KR(ret), K(schema)); | ||||||
|  |       } else if (arg.mv_ainfo_.count() <= 0) { | ||||||
|         ret = OB_ERR_UNEXPECTED; |         ret = OB_ERR_UNEXPECTED; | ||||||
|         LOG_WARN("there should be mv ainfo", KR(ret), K(arg.mv_ainfo_.count())); |         LOG_WARN("there should be mv ainfo", KR(ret), K(arg.mv_ainfo_.count())); | ||||||
|       } else { |       } else { | ||||||
|  | |||||||
| @ -304,7 +304,9 @@ int ObCreateViewResolver::resolve(const ParseNode &parse_tree) | |||||||
|  |  | ||||||
|     if (is_materialized_view) { //container table is only for mv |     if (is_materialized_view) { //container table is only for mv | ||||||
|       if (OB_SUCC(ret)) { |       if (OB_SUCC(ret)) { | ||||||
|         if (OB_FAIL(resolve_table_options(parse_tree.children_[TABLE_OPTION_NODE], false))) { |         if (OB_FAIL(ObResolverUtils::check_schema_valid_for_mview(table_schema))) { | ||||||
|  |           LOG_WARN("failed to check schema valid for mview", KR(ret), K(table_schema)); | ||||||
|  |         } else if (OB_FAIL(resolve_table_options(parse_tree.children_[TABLE_OPTION_NODE], false))) { | ||||||
|           LOG_WARN("fail to resolve table options", KR(ret)); |           LOG_WARN("fail to resolve table options", KR(ret)); | ||||||
|         } |         } | ||||||
|       } |       } | ||||||
|  | |||||||
| @ -8622,5 +8622,23 @@ int64_t ObResolverUtils::get_mysql_max_partition_num(const uint64_t tenant_id) | |||||||
|   return max_partition_num; |   return max_partition_num; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | int ObResolverUtils::check_schema_valid_for_mview(const ObTableSchema &table_schema) | ||||||
|  | { | ||||||
|  |   int ret = OB_SUCCESS; | ||||||
|  |   for (int64_t i = 0; OB_SUCC(ret) && (i < table_schema.get_column_count()); ++i) { | ||||||
|  |     const ObColumnSchemaV2 *column_schema = nullptr; | ||||||
|  |     if (OB_ISNULL(column_schema = table_schema.get_column_schema_by_idx(i))) { | ||||||
|  |       ret = OB_ERR_UNEXPECTED; | ||||||
|  |       LOG_WARN("column schema is null", KR(ret)); | ||||||
|  |     } else if (column_schema->is_xmltype()) { | ||||||
|  |       ret = OB_NOT_SUPPORTED; | ||||||
|  |       LOG_WARN("create materialized view on xmltype columns is not supported", KR(ret)); | ||||||
|  |       LOG_USER_ERROR(OB_NOT_SUPPORTED, | ||||||
|  |           "create materialized view on xmltype columns is"); | ||||||
|  |     } | ||||||
|  |   } | ||||||
|  |   return ret; | ||||||
|  | } | ||||||
|  |  | ||||||
| }  // namespace sql | }  // namespace sql | ||||||
| }  // namespace oceanbase | }  // namespace oceanbase | ||||||
|  | |||||||
| @ -789,6 +789,7 @@ public: | |||||||
|       const share::schema::ObTableSchema &table_schema); |       const share::schema::ObTableSchema &table_schema); | ||||||
|  |  | ||||||
|   static int64_t get_mysql_max_partition_num(const uint64_t tenant_id); |   static int64_t get_mysql_max_partition_num(const uint64_t tenant_id); | ||||||
|  |   static int check_schema_valid_for_mview(const share::schema::ObTableSchema &table_schema); | ||||||
| private: | private: | ||||||
|   static int try_convert_to_unsiged(const ObExprResType restype, |   static int try_convert_to_unsiged(const ObExprResType restype, | ||||||
|                                     ObRawExpr& src_expr, |                                     ObRawExpr& src_expr, | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user
	 leftgeek
					leftgeek