Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
画布下的乐园
oceanbase
提交
169c793d
O
oceanbase
项目概览
画布下的乐园
/
oceanbase
与 Fork 源项目一致
Fork自
oceanbase / oceanbase
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
oceanbase
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
169c793d
编写于
11月 03, 2022
作者:
Y
YoungYang0820
提交者:
wangzelin.wzl
11月 03, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix convert character not changing enum extended type info
上级
b9c75f3c
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
54 addition
and
41 deletion
+54
-41
src/rootserver/ob_ddl_service.cpp
src/rootserver/ob_ddl_service.cpp
+53
-40
src/rootserver/ob_ddl_service.h
src/rootserver/ob_ddl_service.h
+1
-1
未找到文件。
src/rootserver/ob_ddl_service.cpp
浏览文件 @
169c793d
...
...
@@ -3540,39 +3540,52 @@ int ObDDLService::convert_to_character(
int ret = OB_SUCCESS;
const bool bind_tablets = false;
bool can_convert = false;
const ObSQLMode sql_mode = alter_table_arg.alter_table_schema_.get_sql_mode();
bool is_oracle_mode = false;
AlterTableSchema &alter_table_schema = alter_table_arg.alter_table_schema_;
ObCollationType collation_type = alter_table_schema.get_collation_type();
new_table_schema.set_collation_type(collation_type);
new_table_schema.set_charset_type(ObCharset::charset_type_by_coll(collation_type));
ObTableSchema::const_column_iterator tmp_begin = orig_table_schema.column_begin();
ObTableSchema::const_column_iterator tmp_end = orig_table_schema.column_end();
for (; OB_SUCC(ret) && tmp_begin != tmp_end; tmp_begin++) {
ObColumnSchemaV2 *orig_col = (*tmp_begin);
if (OB_ISNULL(orig_col)) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("col is NULL", K(ret));
} else if (OB_FAIL(check_can_convert_to_character(*orig_col, can_convert))) {
LOG_WARN("check can convert to character", K(ret));
} else if (can_convert) {
ObColumnSchemaV2 *col = new_table_schema.get_column_schema(orig_col->get_column_name());
if (OB_ISNULL(col)) {
if (OB_FAIL(orig_table_schema.check_if_oracle_compat_mode(is_oracle_mode))) {
LOG_WARN("failed to get oracle mode", K(ret));
} else {
for (; OB_SUCC(ret) && tmp_begin != tmp_end; tmp_begin++) {
ObColumnSchemaV2 *orig_col = (*tmp_begin);
if (OB_ISNULL(orig_col)) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("col is NULL", K(ret));
} else {
col->set_collation_type(collation_type);
col->set_charset_type(ObCharset::charset_type_by_coll(collation_type));
} else if (OB_FAIL(check_can_convert_to_character(*orig_col, can_convert))) {
LOG_WARN("check can convert to character", K(ret));
} else if (can_convert) {
ObColumnSchemaV2 *col = new_table_schema.get_column_schema(orig_col->get_column_name());
if (OB_ISNULL(col)) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("col is NULL", K(ret));
} else {
col->set_collation_type(collation_type);
col->set_charset_type(ObCharset::charset_type_by_coll(collation_type));
if (OB_FAIL(fill_column_collation(sql_mode,
is_oracle_mode,
new_table_schema,
alter_table_arg.allocator_,
*col))) {
LOG_WARN("failed to fill column collation", K(ret));
}
}
}
}
OZ (create_user_hidden_table(orig_table_schema,
new_table_schema,
&alter_table_arg.sequence_ddl_arg_,
bind_tablets,
schema_guard,
frozen_version,
ddl_operator,
trans,
alter_table_arg.allocator_));
}
OZ (create_user_hidden_table(orig_table_schema,
new_table_schema,
&alter_table_arg.sequence_ddl_arg_,
bind_tablets,
schema_guard,
frozen_version,
ddl_operator,
trans,
alter_table_arg.allocator_));
return ret;
}
...
...
@@ -5762,47 +5775,47 @@ int ObDDLService::fill_column_collation(
const bool is_oracle_mode,
const ObTableSchema &table_schema,
common::ObIAllocator &allocator,
AlterColumnSchema &alter_
column_schema)
ObColumnSchemaV2 &
column_schema)
{
int ret = OB_SUCCESS;
ObObjTypeClass col_tc =
alter_
column_schema.get_data_type_class();
ObObjTypeClass col_tc = column_schema.get_data_type_class();
ObCollationType collation_type = table_schema.get_collation_type();
ObCharsetType charset_type = table_schema.get_charset_type();
const ObCollationType cur_extended_type_info_collation = ObCharset::get_system_collation();
if (ObStringTC == col_tc) {
if (OB_FAIL(ObDDLResolver::check_and_fill_column_charset_info(
alter_
column_schema, charset_type, collation_type))) {
column_schema, charset_type, collation_type))) {
RS_LOG(WARN, "failed to fill column charset info", K(ret));
} else if (OB_FAIL(ObDDLResolver::check_string_column_length(
alter_
column_schema, is_oracle_mode))) {
column_schema, is_oracle_mode))) {
RS_LOG(WARN, "failed to check string column length", K(ret));
}
} else if (ObRawTC == col_tc) {
if (OB_FAIL(ObDDLResolver::check_raw_column_length(
alter_
column_schema))) {
RS_LOG(WARN, "failed to check raw column length", K(ret), K(
alter_
column_schema));
if (OB_FAIL(ObDDLResolver::check_raw_column_length(column_schema))) {
RS_LOG(WARN, "failed to check raw column length", K(ret), K(column_schema));
}
} else if (ob_is_text_tc(
alter_
column_schema.get_data_type())) {
} else if (ob_is_text_tc(column_schema.get_data_type())) {
if (OB_FAIL(ObDDLResolver::check_and_fill_column_charset_info(
alter_
column_schema, table_schema.get_charset_type(), table_schema.get_collation_type()))) {
column_schema, table_schema.get_charset_type(), table_schema.get_collation_type()))) {
RS_LOG(WARN, "failed to fill column charset info", K(ret));
} else if (OB_FAIL(ObDDLResolver::check_text_column_length_and_promote(
alter_
column_schema,
} else if (OB_FAIL(ObDDLResolver::check_text_column_length_and_promote(column_schema,
table_schema.get_table_id()))) {
RS_LOG(WARN, "failed to check text or blob column length", K(ret));
}
} else if (ObEnumSetTC == col_tc) {
if (OB_FAIL(ObDDLResolver::check_and_fill_column_charset_info(
alter_
column_schema, charset_type, collation_type))) {
LOG_WARN("fail to check and fill column charset info", K(ret), K(
alter_
column_schema));
if (OB_FAIL(ObDDLResolver::check_and_fill_column_charset_info(column_schema, charset_type, collation_type))) {
LOG_WARN("fail to check and fill column charset info", K(ret), K(column_schema));
} else if (OB_FAIL(ObResolverUtils::check_extended_type_info(
allocator,
alter_
column_schema.get_extended_type_info(),
column_schema.get_extended_type_info(),
cur_extended_type_info_collation,
alter_
column_schema.get_column_name_str(),
alter_
column_schema.get_data_type(),
alter_
column_schema.get_collation_type(),
column_schema.get_column_name_str(),
column_schema.get_data_type(),
column_schema.get_collation_type(),
sql_mode))) {
LOG_WARN("fail to fill extended type info", K(ret), K(
alter_
column_schema));
} else if (OB_FAIL(ObDDLResolver::calc_enum_or_set_data_length(
alter_
column_schema))) {
LOG_WARN("fail to calc data length", K(ret), K(
alter_
column_schema));
LOG_WARN("fail to fill extended type info", K(ret), K(column_schema));
} else if (OB_FAIL(ObDDLResolver::calc_enum_or_set_data_length(column_schema))) {
LOG_WARN("fail to calc data length", K(ret), K(column_schema));
}
}
return ret;
src/rootserver/ob_ddl_service.h
浏览文件 @
169c793d
...
...
@@ -1462,7 +1462,7 @@ private:
const
bool
is_oracle_mode
,
const
share
::
schema
::
ObTableSchema
&
table_schema
,
common
::
ObIAllocator
&
allocator
,
share
::
schema
::
AlterColumnSchema
&
alter_column_schema
);
share
::
schema
::
ObColumnSchemaV2
&
alter_column_schema
);
int
resolve_orig_default_value
(
share
::
schema
::
ObColumnSchemaV2
&
column_schema
,
const
common
::
ObTimeZoneInfoWrap
&
tz_info_wrap
,
const
common
::
ObString
*
nls_formats
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录