change partition key attribute report error
- Dominant language
- Go
- Stars
- 40.5k
- Forks
- 6.2k
- PR merge metrics
- PR metrics pending
Description
## Bug Report
Please answer these questions before submitting your issue. Thanks!
### 1. Minimal reproduce step (Required)
```sql
CREATE TABLE quarterly_report_status (
report_id INT NOT NULL,
report_status VARCHAR(20) NOT NULL,
report_updated TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
)
PARTITION BY RANGE ( UNIX_TIMESTAMP(report_updated) ) (
PARTITION p0 VALUES LESS THAN ( UNIX_TIMESTAMP('2008-01-01 00:00:00') ),
PARTITION p1 VALUES LESS THAN ( UNIX_TIMESTAMP('2008-04-01 00:00:00') ),
PARTITION p2 VALUES LESS THAN ( UNIX_TIMESTAMP('2008-07-01 00:00:00') ),
PARTITION p3 VALUES LESS THAN ( UNIX_TIMESTAMP('2008-10-01 00:00:00') ),
PARTITION p4 VALUES LESS THAN ( UNIX_TIMESTAMP('2009-01-01 00:00:00') ),
PARTITION p5 VALUES LESS THAN ( UNIX_TIMESTAMP('2009-04-01 00:00:00') ),
PARTITION p6 VALUES LESS THAN ( UNIX_TIMESTAMP('2009-07-01 00:00:00') ),
PARTITION p7 VALUES LESS THAN ( UNIX_TIMESTAMP('2009-10-01 00:00:00') ),
PARTITION p8 VALUES LESS THAN ( UNIX_TIMESTAMP('2010-01-01 00:00:00') ),
PARTITION p9 VALUES LESS THAN (MAXVALUE)
);
alter table quarterly_report_status modify column report_updated TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP;
```
### 2. What did you expect to see? (Required)
change success or report more clear error info
### 3. What did you see instead (Required)
```sql
[17:52:53]TiDB root:test> alter table quarterly_report_status modify column report_updated TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP;
(1659, "Field 'report_updated' is of a not allowed type for this type of partitioning")
```
### 4. What is your TiDB version? (Required)
```sql
[18:02:19]TiDB root:test> select tidb_version();
+-----------------------------------------------------------+
| tidb_version() |
+-----------------------------------------------------------+
| Release Version: v7.3.0-alpha |
| Edition: Community |
| Git Commit Hash: 75444807abc9c50660a091a771942a38a1507bb3 |
| Git Branch: heads/refs/tags/v7.3.0-alpha |
| UTC Build Time: 2023-07-11 14:27:34 |
| GoVersion: go1.20.5 |
| Race Enabled: false |
| Check Table Before Drop: false |
| Store: tikv |
+-----------------------------------------------------------+
1 row in set
Time: 0.003s
```
Contributor guide
Assessment
This issue has not been assessed yet.