Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.
Original topic: V5.0.1怎么设置可以支持修改字段长度
【TiDB Usage Environment】Testing
【TiDB Version】V5.0.1
【Encountered Problem】Error when modifying varchar field length from longer to shorter. Unsupported modify column: length 10 is less than origin 150
【Reproduction Path】Operations performed that led to the issue
【Problem Phenomenon and Impact】
Unsupported modify column: length 10 is less than origin 150
【Attachments】
Please provide the version information of each component, such as cdc/tikv, which can be obtained by executing cdc version/tikv-server --version.
Lower versions indeed do not support lossy changes:
If it’s for testing, you can add a new varchar(10) field and then update the data over.
If it’s for production, what I did at the time was to create a new table, then use the synchronization routing feature to update the data in real-time, then pause the business for a short period (using methods like read-only), and then rename the table. The impact is relatively small, but of course, upgrading would be better.
Is this to shorten the length of the field?
You can upgrade, it has been supported since version 5.1.0.
Setting GLOBAL tidb_enable_change_column_type=1;
can solve the issue.
This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.