pingcap / tidb

TiDB is an open-source, cloud-native, distributed, MySQL-Compatible database for elastic scale and real-time analytics. Try AI-powered Chat2Query free at : https://www.pingcap.com/tidb-serverless/
https://pingcap.com
Apache License 2.0
36.86k stars 5.8k forks source link

Decimal type fields cannot be resized or precision improved within the partition table #54441

Open tonyhu214 opened 2 months ago

tonyhu214 commented 2 months ago

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

create table test( id int not null primary key auto_increment, cost decimal(10,0) default 0 not null )engine = innodb partition by hash(id) PARTITIONS 4 ;

alter table test modify column cost decimal(20,4) default 0 not null;

2. What did you expect to see? (Required)

sql error : Unsupported modify column: table is partition table

3. What did you see instead (Required)

Change fields to decimal(20,4)

4. What is your TiDB version? (Required)

6.5.0 +

River2000i commented 1 month ago

seems block from https://github.com/pingcap/tidb/blob/7d5f1d75bd350d5caa213a0aa8d6fec169553429/pkg/ddl/ddl_api.go#L6006-L6014

tonyhu214 commented 1 month ago

TKS!Based on your information, I took a closer look at the code for the needChangeColumnData function. https://github.com/pingcap/tidb/blob/d8098b970893c850cc318727d9dc336d0a677f35/pkg/ddl/column.go#L386-L402 How do I go about understanding how the decimal type is stored in TiDB?Is there any code that can be viewed?

tonyhu214 commented 1 month ago

Of course. MySQL supports changes to the decimal type of partitioned tables. I hope Tidb can also support it.