Prohibit renaming column with func index deps.

This commit is contained in:
Zach41
2023-09-11 07:40:33 +00:00
committed by ob-robot
parent fe15aec896
commit 7d061822ab
4 changed files with 13 additions and 7 deletions

View File

@ -12267,11 +12267,11 @@ static const _error _error_OB_ERR_DEPENDENT_BY_FUNCTIONAL_INDEX = {
.error_solution = "Contact OceanBase Support", .error_solution = "Contact OceanBase Support",
.mysql_errno = ER_DEPENDENT_BY_FUNCTIONAL_INDEX, .mysql_errno = ER_DEPENDENT_BY_FUNCTIONAL_INDEX,
.sqlstate = "HY000", .sqlstate = "HY000",
.str_error = "Column has a functional index dependency and cannot be dropped.", .str_error = "Column has a functional index dependency and cannot be dropped or renamed.",
.str_user_error = "Column '%.*s' has a functional index dependency and cannot be dropped.", .str_user_error = "Column '%.*s' has a functional index dependency and cannot be dropped or renamed.",
.oracle_errno = 600, .oracle_errno = 600,
.oracle_str_error = "ORA-00600: internal error code, arguments: -5497, Column has a functional index dependency and cannot be dropped.", .oracle_str_error = "ORA-00600: internal error code, arguments: -5497, Column has a functional index dependency and cannot be dropped or renamed.",
.oracle_str_user_error = "ORA-00600: internal error code, arguments: -5497, Column '%.*s' has a functional index dependency and cannot be dropped." .oracle_str_user_error = "ORA-00600: internal error code, arguments: -5497, Column '%.*s' has a functional index dependency and cannot be dropped or renamed."
}; };
static const _error _error_OB_ERR_FUNCTIONAL_INDEX_ON_LOB = { static const _error _error_OB_ERR_FUNCTIONAL_INDEX_ON_LOB = {
.error_name = "OB_ERR_FUNCTIONAL_INDEX_ON_LOB", .error_name = "OB_ERR_FUNCTIONAL_INDEX_ON_LOB",

View File

@ -1140,7 +1140,7 @@ DEFINE_ORACLE_ERROR(OB_ERR_INVALID_WAIT_INTERVAL, -5495, -1, "HY000", "missing o
//for functional index in mysql mode //for functional index in mysql mode
DEFINE_ERROR_EXT(OB_ERR_FUNCTIONAL_INDEX_REF_AUTO_INCREMENT, -5496, ER_FUNCTIONAL_INDEX_REF_AUTO_INCREMENT, "HY000", "Functional index cannot refer to an auto-increment column.", "Functional index '%.*s' cannot refer to an auto-increment column."); DEFINE_ERROR_EXT(OB_ERR_FUNCTIONAL_INDEX_REF_AUTO_INCREMENT, -5496, ER_FUNCTIONAL_INDEX_REF_AUTO_INCREMENT, "HY000", "Functional index cannot refer to an auto-increment column.", "Functional index '%.*s' cannot refer to an auto-increment column.");
DEFINE_ERROR_EXT(OB_ERR_DEPENDENT_BY_FUNCTIONAL_INDEX, -5497, ER_DEPENDENT_BY_FUNCTIONAL_INDEX, "HY000", "Column has a functional index dependency and cannot be dropped.", "Column '%.*s' has a functional index dependency and cannot be dropped."); DEFINE_ERROR_EXT(OB_ERR_DEPENDENT_BY_FUNCTIONAL_INDEX, -5497, ER_DEPENDENT_BY_FUNCTIONAL_INDEX, "HY000", "Column has a functional index dependency and cannot be dropped or renamed.", "Column '%.*s' has a functional index dependency and cannot be dropped or renamed.");
DEFINE_ERROR(OB_ERR_FUNCTIONAL_INDEX_ON_LOB, -5498, ER_FUNCTIONAL_INDEX_ON_LOB, "HY000", "Cannot create a functional index on an expression that returns a BLOB or TEXT. Please consider using CAST."); DEFINE_ERROR(OB_ERR_FUNCTIONAL_INDEX_ON_LOB, -5498, ER_FUNCTIONAL_INDEX_ON_LOB, "HY000", "Cannot create a functional index on an expression that returns a BLOB or TEXT. Please consider using CAST.");
DEFINE_ERROR(OB_ERR_FUNCTIONAL_INDEX_ON_FIELD, -5499, ER_FUNCTIONAL_INDEX_ON_FIELD, "HY000", "Functional index on a column is not supported. Consider using a regular index instead."); DEFINE_ERROR(OB_ERR_FUNCTIONAL_INDEX_ON_FIELD, -5499, ER_FUNCTIONAL_INDEX_ON_FIELD, "HY000", "Functional index on a column is not supported. Consider using a regular index instead.");
DEFINE_ERROR(OB_ERR_GENCOL_LEGIT_CHECK_FAILED, -5500, -1, "HY000", "Legitimacy check failed for generated columns."); DEFINE_ERROR(OB_ERR_GENCOL_LEGIT_CHECK_FAILED, -5500, -1, "HY000", "Legitimacy check failed for generated columns.");

View File

@ -2808,7 +2808,7 @@ constexpr int OB_ERR_INVALID_DATE_MSG_FMT_V2 = -4219;
#define OB_ERR_RENAME_SUBPARTITION_NAME_DUPLICATE__USER_ERROR_MSG "Duplicate partition name %.*s" #define OB_ERR_RENAME_SUBPARTITION_NAME_DUPLICATE__USER_ERROR_MSG "Duplicate partition name %.*s"
#define OB_ERR_INVALID_WAIT_INTERVAL__USER_ERROR_MSG "missing or invalid WAIT interval" #define OB_ERR_INVALID_WAIT_INTERVAL__USER_ERROR_MSG "missing or invalid WAIT interval"
#define OB_ERR_FUNCTIONAL_INDEX_REF_AUTO_INCREMENT__USER_ERROR_MSG "Functional index '%.*s' cannot refer to an auto-increment column." #define OB_ERR_FUNCTIONAL_INDEX_REF_AUTO_INCREMENT__USER_ERROR_MSG "Functional index '%.*s' cannot refer to an auto-increment column."
#define OB_ERR_DEPENDENT_BY_FUNCTIONAL_INDEX__USER_ERROR_MSG "Column '%.*s' has a functional index dependency and cannot be dropped." #define OB_ERR_DEPENDENT_BY_FUNCTIONAL_INDEX__USER_ERROR_MSG "Column '%.*s' has a functional index dependency and cannot be dropped or renamed."
#define OB_ERR_FUNCTIONAL_INDEX_ON_LOB__USER_ERROR_MSG "Cannot create a functional index on an expression that returns a BLOB or TEXT. Please consider using CAST." #define OB_ERR_FUNCTIONAL_INDEX_ON_LOB__USER_ERROR_MSG "Cannot create a functional index on an expression that returns a BLOB or TEXT. Please consider using CAST."
#define OB_ERR_FUNCTIONAL_INDEX_ON_FIELD__USER_ERROR_MSG "Functional index on a column is not supported. Consider using a regular index instead." #define OB_ERR_FUNCTIONAL_INDEX_ON_FIELD__USER_ERROR_MSG "Functional index on a column is not supported. Consider using a regular index instead."
#define OB_ERR_GENCOL_LEGIT_CHECK_FAILED__USER_ERROR_MSG "Legitimacy check failed for generated columns." #define OB_ERR_GENCOL_LEGIT_CHECK_FAILED__USER_ERROR_MSG "Legitimacy check failed for generated columns."
@ -4936,7 +4936,7 @@ constexpr int OB_ERR_INVALID_DATE_MSG_FMT_V2 = -4219;
#define OB_ERR_RENAME_SUBPARTITION_NAME_DUPLICATE__ORA_USER_ERROR_MSG "ORA-14263: New subpartition name %.*s must differ from that of any other partition or subpartition of the object." #define OB_ERR_RENAME_SUBPARTITION_NAME_DUPLICATE__ORA_USER_ERROR_MSG "ORA-14263: New subpartition name %.*s must differ from that of any other partition or subpartition of the object."
#define OB_ERR_INVALID_WAIT_INTERVAL__ORA_USER_ERROR_MSG "ORA-30005: missing or invalid WAIT interval" #define OB_ERR_INVALID_WAIT_INTERVAL__ORA_USER_ERROR_MSG "ORA-30005: missing or invalid WAIT interval"
#define OB_ERR_FUNCTIONAL_INDEX_REF_AUTO_INCREMENT__ORA_USER_ERROR_MSG "ORA-00600: internal error code, arguments: -5496, Functional index '%.*s' cannot refer to an auto-increment column." #define OB_ERR_FUNCTIONAL_INDEX_REF_AUTO_INCREMENT__ORA_USER_ERROR_MSG "ORA-00600: internal error code, arguments: -5496, Functional index '%.*s' cannot refer to an auto-increment column."
#define OB_ERR_DEPENDENT_BY_FUNCTIONAL_INDEX__ORA_USER_ERROR_MSG "ORA-00600: internal error code, arguments: -5497, Column '%.*s' has a functional index dependency and cannot be dropped." #define OB_ERR_DEPENDENT_BY_FUNCTIONAL_INDEX__ORA_USER_ERROR_MSG "ORA-00600: internal error code, arguments: -5497, Column '%.*s' has a functional index dependency and cannot be dropped or renamed."
#define OB_ERR_FUNCTIONAL_INDEX_ON_LOB__ORA_USER_ERROR_MSG "ORA-00600: internal error code, arguments: -5498, Cannot create a functional index on an expression that returns a BLOB or TEXT. Please consider using CAST." #define OB_ERR_FUNCTIONAL_INDEX_ON_LOB__ORA_USER_ERROR_MSG "ORA-00600: internal error code, arguments: -5498, Cannot create a functional index on an expression that returns a BLOB or TEXT. Please consider using CAST."
#define OB_ERR_FUNCTIONAL_INDEX_ON_FIELD__ORA_USER_ERROR_MSG "ORA-00600: internal error code, arguments: -5499, Functional index on a column is not supported. Consider using a regular index instead." #define OB_ERR_FUNCTIONAL_INDEX_ON_FIELD__ORA_USER_ERROR_MSG "ORA-00600: internal error code, arguments: -5499, Functional index on a column is not supported. Consider using a regular index instead."
#define OB_ERR_GENCOL_LEGIT_CHECK_FAILED__ORA_USER_ERROR_MSG "ORA-00600: internal error code, arguments: -5500, Legitimacy check failed for generated columns." #define OB_ERR_GENCOL_LEGIT_CHECK_FAILED__ORA_USER_ERROR_MSG "ORA-00600: internal error code, arguments: -5500, Legitimacy check failed for generated columns."

View File

@ -5904,6 +5904,12 @@ int ObAlterTableResolver::check_mysql_rename_column(const AlterColumnSchema &alt
alter_column_schema.get_origin_column_name().length(), alter_column_schema.get_origin_column_name().length(),
alter_column_schema.get_origin_column_name().ptr()); alter_column_schema.get_origin_column_name().ptr());
LOG_WARN("alter column has generated column deps", K(ret), K(alter_column_schema)); LOG_WARN("alter column has generated column deps", K(ret), K(alter_column_schema));
} else if (column->is_func_idx_column()) { // renname column with func index deps is forbidden
ret = OB_ERR_DEPENDENT_BY_FUNCTIONAL_INDEX;
LOG_USER_ERROR(OB_ERR_DEPENDENT_BY_FUNCTIONAL_INDEX,
alter_column_schema.get_origin_column_name().length(),
alter_column_schema.get_origin_column_name().ptr());
LOG_WARN("alter column has function index deps", K(ret), K(alter_column_schema));
} }
} }
} }