[Bug]: RENAME COLUMN leaves stale partition expression and unreplayable SHOW CREATE
Maintainer thường phản hồi trong vòng 1 ngày
@matrix-meow đang làm issue này rồi.
Từ ngày 27/11/2026.
Đánh giá
Issue này chưa được đánh giá.
Mô tả
Is there an existing issue for the same bug?
- I have checked the existing issues.
Searched open and closed issues for RENAME COLUMN with partition keys/expressions, stale SHOW CREATE partition definitions, and column a does not exist. Closed #26839 is the analogous stale-name problem for CHECK constraint SQL only; it does not cover partition expressions. #30256 concerns dependencies within one combined ALTER, and #12927 is a general partition optimization feature request. None covers this standalone RENAME leaving stale partition metadata.
Branch Name
main
Commit ID
c0cef5c9cce2164fedd201c188bfffe4d2d09a96
Other Environment Information
- Hardware parameters: single-CN local deployment
- OS type: macOS
- Others: reproduced in two independent databases;
git_version()=c0cef5c
Actual Behavior
After renaming a column used by PARTITION BY RANGE(a), the column definition is renamed to x, but SHOW CREATE TABLE still declares PARTITION BY RANGE(a).
Consequences:
- Replaying the emitted SHOW CREATE output under a different table name fails with Error 1054
invalid input: column a does not exist. ALTER TABLE ... ADD PARTITIONon the renamed table fails with the same Error 1054.- Existing rows remain readable, so this is stale schema metadata rather than data loss.
- Renaming
xback toamakes ADD PARTITION and writes to the new partition work again.
A control table with the same initial definition accepts ADD PARTITION when no rename is performed.
Expected Behavior
RENAME COLUMN must update the partitioning expression and the persisted CREATE SQL atomically with the column definition. SHOW CREATE should use PARTITION BY RANGE(x), its output should be replayable, and subsequent partition maintenance should resolve the renamed key.
Steps to Reproduce
DROP DATABASE IF EXISTS repro_partition_rename;
CREATE DATABASE repro_partition_rename;
USE repro_partition_rename;
CREATE TABLE pt(id INT PRIMARY KEY, a INT, b INT)
PARTITION BY RANGE(a)(
PARTITION p0 VALUES LESS THAN(10),
PARTITION p1 VALUES LESS THAN(20)
);
INSERT INTO pt VALUES(1,1,10),(2,11,20);
ALTER TABLE pt RENAME COLUMN a TO x;
SHOW CREATE TABLE pt;
The resulting definition contains the renamed column but the old partition expression:
CREATE TABLE `pt` (
`id` int NOT NULL,
`x` int DEFAULT NULL,
`b` int DEFAULT NULL,
PRIMARY KEY (`id`)
)
PARTITION BY RANGE (`a`) (
PARTITION p0 VALUES LESS THAN (10),
PARTITION p1 VALUES LESS THAN (20)
);
Take that actual SHOW CREATE output, change only the table name from pt to pt_replay, and execute it:
Error 1054: invalid input: column a does not exist
Partition maintenance on the original renamed table fails in the same way:
ALTER TABLE pt ADD PARTITION(
PARTITION p2 VALUES LESS THAN(30)
);
-- Error 1054: invalid input: column a does not exist
SELECT * FROM pt ORDER BY id;
-- (1,1,10),(2,11,20): old rows are still readable
-- Recovery control:
ALTER TABLE pt RENAME COLUMN x TO a;
ALTER TABLE pt ADD PARTITION(
PARTITION p2 VALUES LESS THAN(30)
); -- succeeds
INSERT INTO pt VALUES(3,21,30); -- succeeds
Additional Information
Static inspection of pkg/sql/plan/build_alter_rename_column.go shows updateRenameColumnInTableDef updating column definitions and several dependent expressions, but not rewriting the partition expression or its corresponding stored Createsql. The renamed column catalog and the stale partition metadata therefore disagree immediately after the successful ALTER.
- Ngôn ngữ chính
- Go
- Star
- 1.9k
- Fork
- 312
- Merge trung bình
- 21 giờ 57 phút
- Pull request đã merge (30 ngày)
- 730
Chuẩn bị môi trường
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của matrixorigin/matrixone
-
kind/bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
matrixorigin/matrixone#33363 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
kind/bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
matrixorigin/matrixone#33362 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
SLEEP rejects NULL and negative durations that MySQL acceptsCó thể đã có người làm @XuPeng-SH đã nhận 8 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
matrixorigin/matrixone#32653 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Bug] Shared CI loses Coverage results during GitHub throttling and runs 4.2-dev with the wrong GoCó thể đã có người làm @XuPeng-SH đã nhận hôm nay. Đang mở
matrixorigin/matrixone#33416 · 1 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Bug]: YEAR INTERVAL RANGE window frame passes planning but fails in executorCó thể đã có người làm @matrix-meow đã nhận hôm nay. Đang mởkind/bug needs-triage
matrixorigin/matrixone#33396 · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của matrixorigin/matrixone
Issue tương tự
-
enhancement good first issue help wanted
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 79/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Windows系统上,希望复制路径增加 Unix 格式Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
-
go good first issue help wanted
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Azure/prometheus-collector#1828 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày