diff options
author | Michael Widenius <monty@mariadb.org> | 2018-03-09 14:05:35 +0200 |
---|---|---|
committer | Monty <monty@mariadb.org> | 2018-03-29 13:59:44 +0300 |
commit | a7abddeffa6a760ce948c2dfb007cdf3f1a369d5 (patch) | |
tree | 70eb743fa965a17380bbc0ac88ae79ca1075b896 /mysql-test/main/insert_innodb.test | |
parent | ab1941266c59a19703a74b5593cf3f508a5752d7 (diff) | |
download | mariadb-git-a7abddeffa6a760ce948c2dfb007cdf3f1a369d5.tar.gz |
Create 'main' test directory and move 't' and 'r' there
Diffstat (limited to 'mysql-test/main/insert_innodb.test')
-rw-r--r-- | mysql-test/main/insert_innodb.test | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/mysql-test/main/insert_innodb.test b/mysql-test/main/insert_innodb.test new file mode 100644 index 00000000000..68b6ca4e315 --- /dev/null +++ b/mysql-test/main/insert_innodb.test @@ -0,0 +1,64 @@ +--source include/have_innodb.inc + +# +# MDEV-8979 IGNORE does not ignore the error 1452 +# + +--echo # +--echo # BUG#22037930: INSERT IGNORE FAILS TO IGNORE +--echo # FOREIGN KEY CONSTRAINT + +--echo # Setup. +CREATE TABLE t1 (fld1 INT PRIMARY KEY) ENGINE=INNODB; +CREATE TABLE t2 (fld2 INT, FOREIGN KEY (fld2) REFERENCES t1 (fld1)) +ENGINE=INNODB; +INSERT INTO t1 VALUES(0); +INSERT INTO t2 VALUES(0); + +--echo # Without fix, an error is reported. +INSERT IGNORE INTO t2 VALUES(1); +UPDATE IGNORE t2 SET fld2=20 WHERE fld2=0; +UPDATE IGNORE t1 SET fld1=20 WHERE fld1=0; + +--echo # Test for multi update. +UPDATE IGNORE t1, t2 SET t2.fld2= t2.fld2 + 3; +UPDATE IGNORE t1, t2 SET t1.fld1= t1.fld1 + 3; + +--echo # Reports an error since IGNORE is not used. +--error ER_NO_REFERENCED_ROW_2 +INSERT INTO t2 VALUES(1); + +--error ER_NO_REFERENCED_ROW_2 +UPDATE t2 SET fld2=20 WHERE fld2=0; + +--error ER_ROW_IS_REFERENCED_2 +UPDATE t1 SET fld1=20 WHERE fld1=0; + +--error ER_NO_REFERENCED_ROW_2 +UPDATE t1, t2 SET t2.fld2= t2.fld2 + 3; + +--error ER_ROW_IS_REFERENCED_2 +UPDATE t1, t2 SET t1.fld1= t1.fld1 + 3; + +DROP TABLE t2, t1; + +--echo # +--echo # BUG#22037930: INSERT IGNORE FAILS TO IGNORE FOREIGN +--echo # KEY CONSTRAINT + +CREATE TABLE t1 (fld1 INT PRIMARY KEY) ENGINE= INNODB; + +CREATE TABLE t2 (fld1 VARCHAR(10), fld2 INT NOT NULL, +CONSTRAINT fk FOREIGN KEY (fld2) REFERENCES t1(fld1)) ENGINE= INNODB; + +--echo # Without patch, reports incorrect error. +--error ER_NO_REFERENCED_ROW_2 +INSERT INTO t2 VALUES('abc', 2) ON DUPLICATE KEY UPDATE fld1= 'def'; +--error ER_NO_REFERENCED_ROW_2 +REPLACE INTO t2 VALUES('abc', 2); + +--enable_warnings +INSERT IGNORE INTO t2 VALUES('abc', 2) ON DUPLICATE KEY UPDATE fld1= 'def'; +--disable_warnings + +DROP TABLE t2, t1; |