Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to modify column's default value when has expression index #52355

Open
wd0517 opened this issue Apr 6, 2024 · 5 comments
Open

Failed to modify column's default value when has expression index #52355

wd0517 opened this issue Apr 6, 2024 · 5 comments

Comments

@wd0517
Copy link
Contributor

wd0517 commented Apr 6, 2024

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

@wd0517 wd0517 added the type/bug The issue is confirmed as a bug. label Apr 6, 2024
@jebter jebter added the component/ddl This issue is related to DDL of TiDB. label Apr 7, 2024
@aytrack
Copy link
Contributor

aytrack commented Apr 7, 2024

introduced by #43350

@kennedy8312
Copy link

/type regression

@zimulala zimulala added sig/sql-infra SIG: SQL Infra and removed component/ddl This issue is related to DDL of TiDB. labels Apr 28, 2024
@zimulala
Copy link
Contributor

zimulala commented Apr 28, 2024

In #24321 (v4.0.0), I hope this kind of DDL error raised an issue, Because the generated column also didn't GA, and the generated column's user doc also said not to support (https://docs.pingcap.com/tidb/stable/generated-columns#limitations).

You cannot modify the expression of a stored generated column through the ALTER TABLE statement.

This PR (#43350) will change the behavior, to become an error. But v7.1 (https://docs-archive.pingcap.com/tidb/v7.2/release-7.1.0) to start generating function has the GA.

So what are our options now? Still let it report an error or let it execute successfully?
@bb7133 Help judge how to deal with this behavior.
If we still choose to report errors, we may need to change the error message and change the bug level.

@bb7133 bb7133 self-assigned this May 8, 2024
@tiancaiamao
Copy link
Contributor

I think the current behavior confirm to our previous choice #43455 (comment)

@kennedy8312
Copy link

@tiancaiamao Could please check if anything need to do with the error message for this case?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants