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
[Subtask]: Apply parent-side foreign key actions during REPLACE #24951
Make REPLACE apply parent-side foreign key semantics as delete-then-insert when a conflicting parent row is replaced.
The parent issue includes two representative cases:
ON DELETE RESTRICT: replacing a referenced parent row should fail because the old parent row is deleted before the new row is inserted.
ON DELETE CASCADE: replacing a referenced parent row should delete the old parent row, cascade-delete child rows, then insert the new parent row.
MatrixOne currently replaces the parent row successfully and leaves child rows unchanged in both cases.
Describe implementation you've considered
Model the conflicting-row removal part of REPLACE as a real delete for parent-side FK checks/actions, then perform the insert of the replacement row. Add BVT coverage for RESTRICT and CASCADE, and preserve atomicity when the delete action rejects the statement.
Activity
fix: enforce parent foreign key actions for REPLACE (#26383)
Ariznawlll commentedon Aug 5, 2026
motr 黑盒回归补充
已将该子任务加入 motr PR #75:
ON DELETE CASCADE替换父行后删除全部引用子行并插入新父行。ON DELETE RESTRICT拒绝被引用父行的替换;失败后父、子表数据均保持不变,并验证会话可继续使用。main@607a9263616ea883ac02c052529d2aa4c62ac051连续 3/3 通过(66/66 statements)。6c0d12dfc3c3c8cab7439beaa8efb00b8349a599复现失败:RESTRICT 场景被错误允许。注:当前 MatrixOne 对父表 FK 拒绝返回既有错误码 20101;本 issue 的验收重点是 RESTRICT/CASCADE 语义与原子性。
Ariznawlll commentedon Aug 25, 2026
测试版本
原问题验证
在父表执行 `REPLACE`,分别覆盖 `ON DELETE CASCADE` 与 `ON DELETE RESTRICT`。连续 3 个独立轮次中,父表替换均不再遗漏应执行的父侧外键动作。
Happy Path 覆盖
Unhappy Path 覆盖
白盒验证
不适用;该缺陷的可观察 SQL 语义、错误和失败原子性已由黑盒断言覆盖。
回归测试
已存在稳定的 motr PR #75 回归:issue_24951_replace_parent_fk_actions.test。该场景覆盖 CASCADE、RESTRICT、失败原子性和恢复执行,不需要大数据量测试。
测试证据
测试结论
测试通过。
fix: enforce parent foreign key actions for REPLACE (matrixorigin#26383)
fix: enforce parent foreign key actions for REPLACE (matrixorigin#26383)
fix: enforce parent foreign key actions for REPLACE (matrixorigin#26383)