You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: DELETE FROM ... PARTITION ignores the partition list and deletes every row #28312
4fdb9e91615f9fc37703039ae28a47849206d1d6 (latest main when reproduced), Linux/amd64 standalone launch deployment.
What happened?
The parser accepts the single-table MySQL form DELETE FROM t PARTITION (p0), but the delete planner does not consume tree.Delete.PartitionNames. The delete source therefore scans the whole logical table and every row is deleted.
This was found while challenging #28309/#28310 with adjacent delete-scope restrictions. #28310 deliberately prevents partition-restricted statements from being classified as unrestricted/truncatable, but it does not implement partition pruning; this issue needs its own planner/storage design.
Reproduction
dropdatabase if exists delete_partition_scope;
createdatabasedelete_partition_scope;
use delete_partition_scope;
createtablep(
id intprimary key,
body text
) partition by hash(id) partitions 2;
insert into p values
(1, 'odd token'),
(2, 'even token'),
(3, 'odd three');
deletefrom p partition(p0);
select id from p order by id;
Actual behavior
The final SELECT returns no rows: rows outside p0 are also deleted.
Expected behavior
Only rows in the named partition are eligible for deletion. If partition-qualified DELETE is not supported, planning must reject it explicitly before mutation; it must never silently widen the delete set.
The MySQL grammar populates it for single-table DELETE.
The ordinary delete planning paths do not turn the list into a partition-restricted scan/filter.
A systematic fix should make the partition list part of the delete row-selection contract, validate unknown/duplicate partition names, preserve index/FK maintenance for only selected rows, and cover hash/range/list plus empty/multi-partition cases.
Both reports concern an explicit PARTITION(...) target accepted and then ignored by DML. The active tracker now includes this DELETE reproducer, while retaining independent acceptance for DELETE source-row selection and INSERT/REPLACE destination eligibility. The planner paths differ; one branch's fix is not evidence that the others are fixed.
#31084 retains the same owner and its existing severity/s1. This older deferred entry is closed for consolidated tracking only; the defect remains open in #31084.
Activity
iamlinjunhong commentedon Sep 7, 2026
当前 partition 需要重构,暂时不修复
XuPeng-SH commentedon Oct 25, 2026
Consolidated into #31084.
Both reports concern an explicit PARTITION(...) target accepted and then ignored by DML. The active tracker now includes this DELETE reproducer, while retaining independent acceptance for DELETE source-row selection and INSERT/REPLACE destination eligibility. The planner paths differ; one branch's fix is not evidence that the others are fixed.
#31084 retains the same owner and its existing severity/s1. This older deferred entry is closed for consolidated tracking only; the defect remains open in #31084.