1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-01 03:47:19 +03:00

use consistent error messaging for IGNORE

1. the same message text for INSERT and INSERT IGNORE
2. no new warnings in UPDATE IGNORE yet (big change for 5.5)

and replace a commonly used expression with a
named constant
This commit is contained in:
Sergei Golubchik
2016-04-20 18:27:23 +02:00
parent 9e826bfa36
commit 24ac546d0f
5 changed files with 11 additions and 63 deletions

View File

@ -11,20 +11,11 @@ INSERT INTO t2 VALUES(0);
INSERT IGNORE INTO t2 VALUES(1);
Warnings:
Warning 1452 Cannot add or update a child row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`fld2`) REFERENCES `t1` (`fld1`))
Warning 1452 `test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`fld2`) REFERENCES `t1` (`fld1`)
UPDATE IGNORE t2 SET fld2=20 WHERE fld2=0;
Warnings:
Warning 1452 `test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`fld2`) REFERENCES `t1` (`fld1`)
UPDATE IGNORE t1 SET fld1=20 WHERE fld1=0;
Warnings:
Warning 1451 `test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`fld2`) REFERENCES `t1` (`fld1`)
# Test for multi update.
UPDATE IGNORE t1, t2 SET t2.fld2= t2.fld2 + 3;
Warnings:
Warning 1452 `test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`fld2`) REFERENCES `t1` (`fld1`)
UPDATE IGNORE t1, t2 SET t1.fld1= t1.fld1 + 3;
Warnings:
Warning 1451 `test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`fld2`) REFERENCES `t1` (`fld1`)
# Reports an error since IGNORE is not used.
INSERT INTO t2 VALUES(1);
ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`fld2`) REFERENCES `t1` (`fld1`))