fix mysqltest
This commit is contained in:
@ -284,9 +284,17 @@ int ObExprColumnConv::calc_result_typeN(ObExprResType &type,
|
|||||||
ret = OB_ERR_INVALID_TYPE_FOR_OP;
|
ret = OB_ERR_INVALID_TYPE_FOR_OP;
|
||||||
LOG_WARN("inconsistent datatypes", "expected", type_tc, "got", value_tc);
|
LOG_WARN("inconsistent datatypes", "expected", type_tc, "got", value_tc);
|
||||||
} else {
|
} else {
|
||||||
type_ctx.set_cast_mode(
|
bool is_ddl = const_cast<sql::ObSQLSessionInfo *>(type_ctx.get_session())->get_ddl_info().is_ddl();
|
||||||
type_ctx.get_cast_mode() | type_ctx.get_raw_expr()->get_extra() | CM_COLUMN_CONVERT
|
if (!is_ddl) {
|
||||||
| CM_CHARSET_CONVERT_IGNORE_ERR);
|
type_ctx.set_cast_mode(type_ctx.get_cast_mode() |
|
||||||
|
type_ctx.get_raw_expr()->get_extra() |
|
||||||
|
CM_COLUMN_CONVERT |
|
||||||
|
CM_CHARSET_CONVERT_IGNORE_ERR);
|
||||||
|
} else {
|
||||||
|
type_ctx.set_cast_mode(type_ctx.get_cast_mode() |
|
||||||
|
type_ctx.get_raw_expr()->get_extra() |
|
||||||
|
CM_COLUMN_CONVERT );
|
||||||
|
}
|
||||||
types[4].set_calc_meta(type);
|
types[4].set_calc_meta(type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -563,11 +563,13 @@ int ObCreateViewResolver::check_select_stmt_col_name(
|
|||||||
{
|
{
|
||||||
int ret = OB_SUCCESS;
|
int ret = OB_SUCCESS;
|
||||||
int hash_ret = OB_HASH_NOT_EXIST;
|
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;
|
bool len_is_legal = false;
|
||||||
// 如果列没有被用户指定一个别名,那么 alias_name_ 就和 expr_name_ 保持一致
|
// 如果列没有被用户指定一个别名,那么 alias_name_ 就和 expr_name_ 保持一致
|
||||||
ObString col_name = select_item.alias_name_;
|
ObString col_name = select_item.alias_name_;
|
||||||
if (select_item.is_real_alias_) {
|
if (is_real_alias_) {
|
||||||
// 如果是真的别名,别名长度不允许超过 64,超过则报错
|
// 如果是真的别名,别名长度不允许超过 64,超过则报错
|
||||||
if (col_name.length() > static_cast<size_t>(OB_MAX_VIEW_COLUMN_NAME_LENGTH_MYSQL)) {
|
if (col_name.length() > static_cast<size_t>(OB_MAX_VIEW_COLUMN_NAME_LENGTH_MYSQL)) {
|
||||||
ret = OB_WRONG_COLUMN_NAME;
|
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)) {
|
} else if (col_name.length() > static_cast<size_t>(OB_MAX_VIEW_COLUMN_NAME_LENGTH_MYSQL)) {
|
||||||
// 如果列没有别名,超过 64 的话系统则自动为其会生成一个列别名
|
// 如果列没有别名,超过 64 的话系统则自动为其会生成一个列别名
|
||||||
// 因为需要避免自动生成的列名和用户定义的列名相同的情况,所以这里暂时把这种情况的列序号记录下来
|
// 因为需要避免自动生成的列名和用户定义的列名相同的情况,所以这里暂时把这种情况的列序号记录下来
|
||||||
if (OB_FAIL(index_array.push_back(pos))) {
|
if (OB_FAIL(add_var_to_array_no_dup(index_array, pos))) {
|
||||||
SQL_RESV_LOG(WARN, "push_back failed", K(ret), K(pos), K(col_name));
|
LOG_WARN("failed to add var", K(ret));
|
||||||
|
SQL_RESV_LOG(WARN, "add var failed", K(ret), K(pos), K(col_name));
|
||||||
} else {
|
} else {
|
||||||
len_is_legal = true;
|
len_is_legal = true;
|
||||||
}
|
}
|
||||||
@ -588,11 +591,11 @@ int ObCreateViewResolver::check_select_stmt_col_name(
|
|||||||
if (OB_SUCC(ret) && len_is_legal) {
|
if (OB_SUCC(ret) && len_is_legal) {
|
||||||
// 如果不是超长列名,则检查是否有重名
|
// 如果不是超长列名,则检查是否有重名
|
||||||
if (OB_HASH_EXIST == (hash_ret = view_col_names.exist_refactored(col_name))) {
|
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;
|
is_expr_or_col_dup = true;
|
||||||
dup_col_name = select_item.alias_name_;
|
dup_col_name = select_item.alias_name_;
|
||||||
} else if ((!select_item.is_real_alias_) && OB_FAIL(index_array.push_back(pos))) {
|
} else if ((!is_real_alias_) && OB_FAIL(add_var_to_array_no_dup(index_array, pos))) {
|
||||||
SQL_RESV_LOG(WARN, "push_back failed", K(ret), K(pos), K(col_name));
|
SQL_RESV_LOG(WARN, "add var failed", K(ret), K(pos), K(col_name));
|
||||||
}
|
}
|
||||||
ret = OB_SUCCESS;
|
ret = OB_SUCCESS;
|
||||||
// ret = OB_ERR_COLUMN_DUPLICATE;
|
// ret = OB_ERR_COLUMN_DUPLICATE;
|
||||||
|
|||||||
Reference in New Issue
Block a user