Failed to modify column's default value when has expression index
- Dominant language
- Go
- Stars
- 40.5k
- Forks
- 6.2k
- PR merge metrics
- PR metrics pending
Description
## Bug Report
Please answer these questions before submitting your issue. Thanks!
### 1. Minimal reproduce step (Required)
```
mysql> create table t1 (a char(20) not null, index((lower(a))));
Query OK, 0 rows affected (0.09 sec)
mysql> alter table t1 modify a char(20) default null;
```
### 2. What did you expect to see? (Required)
Success.
### 3. What did you see instead (Required)
```
ERROR 3106 (HY000): '[ddl:3837]Column 'a' has an expression index dependency and cannot be dropped or renamed' is not supported for generated columns.
```
This error message does not match the operation and has a poor format.
I can reproduce this error in both nightly and v7.5.1, but in serverless (`5.7.28-TiDB-v7.1.1-serverless`) it works fine.
### 4. What is your TiDB version? (Required)
```
Release Version: v8.1.0-alpha-24-g555ce02352
Edition: Community
Git Commit Hash: 555ce0235229dc370cc8e63574437cf9ee60bdd0
Git Branch: HEAD
UTC Build Time: 2024-04-03 14:18:26
GoVersion: go1.21.6
Race Enabled: false
Check Table Before Drop: false
Store: tikv
```
From Django tests `migrations.test_operations.OperationTests.test_alter_field_with_func_index`
Contributor guide
Assessment
This issue has not been assessed yet.