pingcap / pingcap/tidb

DROP MATERIALIZED VIEW/LOG is accepted but silently ignored, leaving the objects in place

Open
#70,989 0 comments 0 reactions 0 assignees View on GitHub
affects-9.0 component/mview found-by-ai may-affects-25.10 may-affects-26.3 may-affects-8.5 severity/moderate sig/sql-infra type/bug
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);
INSERT INTO t VALUES (1,10);
CREATE MATERIALIZED VIEW LOG ON t (a,b);
CREATE MATERIALIZED VIEW mv (a,s,c) AS
SELECT a, SUM(b), COUNT(*) FROM t GROUP BY a;

SHOW TABLES; -- t, mv, $mlog$t

DROP MATERIALIZED VIEW mv;
SHOW WARNINGS; -- empty
SHOW TABLES; -- actual: mv still present

DROP MATERIALIZED VIEW LOG ON t;
SHOW WARNINGS; -- empty
SHOW TABLES; -- actual: $mlog$t still present
```

Probe output:

```text
SETUP_TABLES=['$mlog$t', 'mv', 't']
CONTROL_TABLES=['$mlog$t', 'mv', 't']
CONTROL_MV_OBJECTS_PRESENT

TRIGGER_TABLES=['$mlog$t', 'mv', 't']
TIDB_DROP_MVIEW_IGNORED
```

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

Each DROP statement must remove its target object (and any required dependent state), or fail explicitly if the drop is unsupported. A successful DROP must not leave the object present.

### 3. What did you see instead (Required)

Fixture: t, mv, $mlog$t. DROP MATERIALIZED VIEW mv -> success; SHOW TABLES still has mv. DROP MATERIALIZED VIEW LOG ON t -> success; SHOW TABLES still has $mlog$t. No warnings.

### 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:2269-2328 defines DropMaterializedViewStmt and DropMaterializedViewLogStmt
- pkg/parser/parser.y parses both DROP forms
- pkg/executor/ddl.go:161-237 has no case for either drop statement type

Contributor guide

Open the contributing guide

Research direction

Start with the DROP statement definitions in pkg/parser/ast/ddl.go:2269-2328 and the grammar in pkg/parser/parser.y, then inspect the DDL handling in pkg/executor/ddl.go:161-237. Reproduce the provided CREATE and DROP sequence and check SHOW TABLES and SHOW WARNINGS. Done means each DROP removes its target object or fails explicitly when unsupported.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, sql
Domain
databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.