How to Set V5.0.1 to Support Modifying Field Length

Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.

Original topic: V5.0.1怎么设置可以支持修改字段长度

| username: TiDBer_VtkBZH6I

【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.

| username: zhouzeru | Original post link

Try this: unsupported modify column length 255 is less than origin 512 · Issue #8965 · pingcap/tidb · GitHub

| username: db_user | Original post link

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.

| username: Meditator | Original post link

Is this to shorten the length of the field?

| username: forever | Original post link

You can upgrade, it has been supported since version 5.1.0.

| username: TiDBer_VtkBZH6I | Original post link

Setting GLOBAL tidb_enable_change_column_type=1; can solve the issue.

| username: system | Original post link

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.