ALTER MATERIALIZED VIEW LOG ADD COLUMN is accepted but silently ignored, leaving the log schema unchanged
- 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 t(a INT PRIMARY KEY, b INT NOT NULL, c INT NOT NULL);
INSERT INTO t VALUES (1,10,100);
CREATE MATERIALIZED VIEW LOG ON t (a);
SHOW CREATE TABLE `$mlog$t`;
-- tracks a, _MLOG$_DML_TYPE, _MLOG$_OLD_NEW; no b
ALTER MATERIALIZED VIEW LOG ON t ADD COLUMN (b);
SHOW WARNINGS; -- empty
SHOW CREATE TABLE `$mlog$t`;
-- actual: still no b
```
Probe output:
```text
CONTROL_LOG_CREATE='... `a` int NOT NULL, `_MLOG$_DML_TYPE` ... `_MLOG$_OLD_NEW` ...'
CONTROL_MLOG_PRESENT_WITHOUT_B
TRIGGER_LOG_CREATE='... `a` int NOT NULL, `_MLOG$_DML_TYPE` ... `_MLOG$_OLD_NEW` ...'
TIDB_ALTER_MLOG_IGNORED
```
### 2. What did you expect to see? (Required)
`ALTER MATERIALIZED VIEW LOG ... ADD COLUMN (b)` must add `b` to the log schema, and `PURGE` must apply its purge action. If an action is unsupported, the statement must fail explicitly instead of returning success with no effect.
### 3. What did you see instead (Required)
Fixture: base t(a PK,b NOT NULL,c NOT NULL), MV log on t(a). SHOW CREATE TABLE $mlog$t lacks b. ALTER MATERIALIZED VIEW LOG ON t ADD COLUMN (b) -> success, no warnings; SHOW CREATE TABLE $mlog$t still lacks b.
### 4. What is your TiDB version? (Required)
```text
Release Version: v8.4.0-this-is-a-placeholder
Edition: Community
Git Commit Hash: None
Git Branch: None
UTC Build Time: None
GoVersion: go1.25.12
Race Enabled: false
Check Table Before Drop: false
Store: unistore
Kernel Type: Classic
```
Built from source commit `a514a92784c9654502686e6ee6efc9e0aeda8afa` (pingcap/tidb master, 2026-09-07).
### 5. Root cause (optional)
- pkg/parser/ast/ddl.go:2158-2268 defines AlterMaterializedViewLogStmt and ADD COLUMN/PURGE actions
- pkg/parser/parser.y parses ALTER MATERIALIZED VIEW LOG ... ADD COLUMN / PURGE
- pkg/executor/ddl.go:161-237 has no case for *ast.AlterMaterializedViewLogStmt
Contributor guide
Research direction
Start with pkg/parser/ast/ddl.go:2158-2268 and pkg/parser/parser.y to trace the ALTER MATERIALIZED VIEW LOG actions, then inspect pkg/executor/ddl.go:161-237, which currently has no case for this statement. Reproduce the SQL fixture and verify that ADD COLUMN changes the materialized log schema and PURGE performs its action, or that unsupported actions fail explicitly.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, sql
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 68/100