fix mysqltest
This commit is contained in:
@ -563,11 +563,13 @@ int ObCreateViewResolver::check_select_stmt_col_name(
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
int hash_ret = OB_HASH_NOT_EXIST;
|
||||
bool is_real_alias_ = select_item.is_real_alias_ ||
|
||||
ObRawExprUtils::is_column_ref_skip_implicit_cast(select_item.expr_);
|
||||
// 用于检查列名是否超长的标志
|
||||
bool len_is_legal = false;
|
||||
// 如果列没有被用户指定一个别名,那么 alias_name_ 就和 expr_name_ 保持一致
|
||||
ObString col_name = select_item.alias_name_;
|
||||
if (select_item.is_real_alias_) {
|
||||
if (is_real_alias_) {
|
||||
// 如果是真的别名,别名长度不允许超过 64,超过则报错
|
||||
if (col_name.length() > static_cast<size_t>(OB_MAX_VIEW_COLUMN_NAME_LENGTH_MYSQL)) {
|
||||
ret = OB_WRONG_COLUMN_NAME;
|
||||
@ -578,8 +580,9 @@ int ObCreateViewResolver::check_select_stmt_col_name(
|
||||
} else if (col_name.length() > static_cast<size_t>(OB_MAX_VIEW_COLUMN_NAME_LENGTH_MYSQL)) {
|
||||
// 如果列没有别名,超过 64 的话系统则自动为其会生成一个列别名
|
||||
// 因为需要避免自动生成的列名和用户定义的列名相同的情况,所以这里暂时把这种情况的列序号记录下来
|
||||
if (OB_FAIL(index_array.push_back(pos))) {
|
||||
SQL_RESV_LOG(WARN, "push_back failed", K(ret), K(pos), K(col_name));
|
||||
if (OB_FAIL(add_var_to_array_no_dup(index_array, pos))) {
|
||||
LOG_WARN("failed to add var", K(ret));
|
||||
SQL_RESV_LOG(WARN, "add var failed", K(ret), K(pos), K(col_name));
|
||||
} else {
|
||||
len_is_legal = true;
|
||||
}
|
||||
@ -588,11 +591,11 @@ int ObCreateViewResolver::check_select_stmt_col_name(
|
||||
if (OB_SUCC(ret) && len_is_legal) {
|
||||
// 如果不是超长列名,则检查是否有重名
|
||||
if (OB_HASH_EXIST == (hash_ret = view_col_names.exist_refactored(col_name))) {
|
||||
if (dup_col_name.empty() && select_item.is_real_alias_) {
|
||||
if (dup_col_name.empty() && is_real_alias_) {
|
||||
is_expr_or_col_dup = true;
|
||||
dup_col_name = select_item.alias_name_;
|
||||
} else if ((!select_item.is_real_alias_) && OB_FAIL(index_array.push_back(pos))) {
|
||||
SQL_RESV_LOG(WARN, "push_back failed", K(ret), K(pos), K(col_name));
|
||||
} else if ((!is_real_alias_) && OB_FAIL(add_var_to_array_no_dup(index_array, pos))) {
|
||||
SQL_RESV_LOG(WARN, "add var failed", K(ret), K(pos), K(col_name));
|
||||
}
|
||||
ret = OB_SUCCESS;
|
||||
// ret = OB_ERR_COLUMN_DUPLICATE;
|
||||
|
||||
Reference in New Issue
Block a user