[Bug]: RENAME COLUMN leaves stale partition expression and unreplayable SHOW CREATE
Los mantenedores suelen responder en 1 día
@matrix-meow ya está trabajando en esto.
Desde el 27/11/2026.
Evaluación
Este issue todavía no se ha evaluado.
Descripción
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.
- Lenguaje dominante
- Go
- Estrellas
- 1.9k
- Forks
- 312
- Merge medio
- 21 h 57 min
- PR fusionados (30 d)
- 730
Preparar el entorno
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de matrixorigin/matrixone
-
kind/bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
matrixorigin/matrixone#33363 ·
Los mantenedores suelen responder en 1 día
-
kind/bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
matrixorigin/matrixone#33362 ·
Los mantenedores suelen responder en 1 día
-
SLEEP rejects NULL and negative durations that MySQL acceptsPosiblemente ocupada @XuPeng-SH la tomó hace 8 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
matrixorigin/matrixone#32653 ·
Los mantenedores suelen responder en 1 día
-
[Bug] Shared CI loses Coverage results during GitHub throttling and runs 4.2-dev with the wrong GoPosiblemente ocupada @XuPeng-SH la tomó hoy. Abierto
matrixorigin/matrixone#33416 · 1 comentario · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
[Bug]: YEAR INTERVAL RANGE window frame passes planning but fails in executorPosiblemente ocupada @matrix-meow la tomó hoy. Abiertokind/bug needs-triage
matrixorigin/matrixone#33396 · 1 asignado ·
Los mantenedores suelen responder en 1 día
Todos los issues de matrixorigin/matrixone
Issues similares
-
enhancement good first issue help wanted
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 79/100
Los mantenedores suelen responder en 1 día
-
Windows系统上,希望复制路径增加 Unix 格式Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 66/100
-
go good first issue help wanted
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Azure/prometheus-collector#1828 · 1 comentario ·
Los mantenedores suelen responder en 2 días