Repository navigation
Description
Is there an existing issue for the same bug?
- I have checked the existing issues.
Searched open and closed issues for UPDATE IGNORE/DELETE IGNORE, foreign-key Errors 1451/1452, and valid sibling rows. Open #32896 is a broad 4.2 follow-up tracker without this main single-table reproducer. #30500 concerns LOAD DATA, #28254 concerns missing warnings for rows already skipped correctly, and #15345 concerns INSERT IGNORE value compatibility. None owns this ordinary UPDATE/DELETE FK failure.
Branch Name
main
Commit ID
Other Environment Information
- Hardware parameters: single-CN local deployment
- OS type: macOS
- Others: MySQL 8.0.46 used as a control
Actual Behavior
An UPDATE IGNORE that changes one child row to a valid parent key and another row to an orphan key fails as a whole with Error 1452. The valid row is not updated either.
The same root problem affects DELETE IGNORE: when one parent row is protected by RESTRICT and another is deletable, MatrixOne raises Error 1451 and retains both rows.
Expected Behavior
IGNORE should skip only the row with the FK violation. Valid sibling writes in the same statement should still take effect.
For the UPDATE below, the expected final rows are [[1,1,1],[2,1,0]]. For the DELETE variant, only the referenced parent id=1 should remain.
Steps to Reproduce
CREATE TABLE p(id INT PRIMARY KEY);
CREATE TABLE c(
id INT PRIMARY KEY,
pid INT,
v INT,
CONSTRAINT fk FOREIGN KEY(pid) REFERENCES p(id)
);
INSERT INTO p VALUES(1);
INSERT INTO c VALUES(1,1,0),(2,1,0);
UPDATE IGNORE c
SET pid=CASE id WHEN 1 THEN 1 ELSE 99 END,
v=v+1
ORDER BY id;
SELECT * FROM c ORDER BY id;MatrixOne: Error 1452 and [[1,1,0],[2,1,0]].
MySQL 8.0.46: statement succeeds and returns [[1,1,1],[2,1,0]].
Companion DELETE case:
CREATE TABLE p2(id INT PRIMARY KEY,v INT);
CREATE TABLE c2(
id INT PRIMARY KEY,
pid INT,
CONSTRAINT fk2 FOREIGN KEY(pid) REFERENCES p2(id) ON DELETE RESTRICT
);
INSERT INTO p2 VALUES(1,10),(2,20);
INSERT INTO c2 VALUES(1,1);
DELETE IGNORE FROM p2 WHERE id IN(1,2) ORDER BY id;
SELECT * FROM p2 ORDER BY id;MatrixOne: Error 1451 and both parent rows remain. MySQL succeeds and deletes only id=2.
Controls and scope
After each MatrixOne error, the original rows are unchanged in the same connection. A subsequent fully valid UPDATE/DELETE succeeds, and SELECT 42 remains healthy. Two fresh-database rounds on each engine produced the same results.
UPDATE and DELETE are combined because both show FK conflicts bypassing IGNORE's row-level skip path. This is distinct from the separate UNIQUE-key arbitration and warning-reporting issues.
Activity