Unsupported Modify Column: Can't Change Decimal Column Precision

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

Original topic: Unsupported modify column: can’t change decimal column precision

| username: Kongdom

[TiDB Usage Environment] Online
[TiDB Version] 5.7.25-TiDB-v4.0.16
[Encountered Problem] Error when modifying column type
[Reproduction Path]

USE test;
CREATE TABLE tmp_202208020930( c_money decimal(18, 0) NULL );
ALTER TABLE tmp_202208020930 MODIFY COLUMN c_money decimal(18, 4) NULL;

[Problem Phenomenon and Impact]

SQL Error [8200] [HY000]: Unsupported modify column: can’t change decimal column precision

PS: Executing select @@tidb_enable_change_column_type; prompts that the variable cannot be found. It should have nothing to do with lossless or lossy changes, as changing the precision to (22,4) also results in an error.

| username: hey-hoho | Original post link

Version 4.0 does not support modifying the precision of decimal; it is supported starting from version 5.1.

| username: Kongdom | Original post link

It shouldn’t be, right? In version 5.0, it can be supported by modifying tidb_enable_change_column_type.

| username: Kongdom | Original post link

This is the modification plan for version 5.0

| username: hey-hoho | Original post link

I guess what works in 5.0 might not necessarily work in 4.0 :rofl:

| username: Kongdom | Original post link

I found the clear explanation for version 4.0, which is that it is not supported.

| username: Kongdom | Original post link

This topic was automatically closed 60 days after the last reply. No new replies are allowed.