diff --git a/src/share/ob_errno.cpp b/src/share/ob_errno.cpp index 8389563631..6e0aebca43 100755 --- a/src/share/ob_errno.cpp +++ b/src/share/ob_errno.cpp @@ -12267,11 +12267,11 @@ static const _error _error_OB_ERR_DEPENDENT_BY_FUNCTIONAL_INDEX = { .error_solution = "Contact OceanBase Support", .mysql_errno = ER_DEPENDENT_BY_FUNCTIONAL_INDEX, .sqlstate = "HY000", - .str_error = "Column has a functional index dependency and cannot be dropped.", - .str_user_error = "Column '%.*s' 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 or renamed.", .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_user_error = "ORA-00600: internal error code, arguments: -5497, Column '%.*s' 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 or renamed." }; static const _error _error_OB_ERR_FUNCTIONAL_INDEX_ON_LOB = { .error_name = "OB_ERR_FUNCTIONAL_INDEX_ON_LOB", diff --git a/src/share/ob_errno.def b/src/share/ob_errno.def index fe33924d64..15279c45a0 100755 --- a/src/share/ob_errno.def +++ b/src/share/ob_errno.def @@ -1140,7 +1140,7 @@ DEFINE_ORACLE_ERROR(OB_ERR_INVALID_WAIT_INTERVAL, -5495, -1, "HY000", "missing o //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_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_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."); diff --git a/src/share/ob_errno.h b/src/share/ob_errno.h index eab01fc288..e341b68445 100755 --- a/src/share/ob_errno.h +++ b/src/share/ob_errno.h @@ -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_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_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_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." @@ -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_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_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_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." diff --git a/src/sql/resolver/ddl/ob_alter_table_resolver.cpp b/src/sql/resolver/ddl/ob_alter_table_resolver.cpp index 75922f7841..70993284e0 100644 --- a/src/sql/resolver/ddl/ob_alter_table_resolver.cpp +++ b/src/sql/resolver/ddl/ob_alter_table_resolver.cpp @@ -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().ptr()); 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)); } } }