summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorEugene Kosov <claprix@yandex.ru>2019-01-25 12:04:28 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2019-01-25 16:35:50 +0200
commit0e1f7f5c4a7eb90f345f2c2da6b4d7ce0b4056c4 (patch)
tree3306297d0edeee6e549bafcc160b28bba314c1a6 /mysql-test
parent9bd80ada6facfb4ae3d159f3c924c1845c8d3481 (diff)
downloadmariadb-git-0e1f7f5c4a7eb90f345f2c2da6b4d7ce0b4056c4.tar.gz
MDEV-18057 Assertion `(node->state == 5) || (node->state == 6)' failed in row_upd_sec_step upon DELETE after UPDATE failed due to FK violation
The idea of the fix: reset state from previous query. row_upd_clust_step(): reset cached index before updating a clustered index Closes #1133
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/suite/versioning/r/foreign.result9
-rw-r--r--mysql-test/suite/versioning/t/foreign.test14
2 files changed, 23 insertions, 0 deletions
diff --git a/mysql-test/suite/versioning/r/foreign.result b/mysql-test/suite/versioning/r/foreign.result
index edf5632f027..a7a84f539bf 100644
--- a/mysql-test/suite/versioning/r/foreign.result
+++ b/mysql-test/suite/versioning/r/foreign.result
@@ -290,3 +290,12 @@ select count(*) from subchild;
count(*)
0
drop table subchild, child, parent;
+CREATE TABLE t1 (f1 INT, KEY(f1)) ENGINE=InnoDB;
+CREATE TABLE t2 (f2 INT, FOREIGN KEY (f2) REFERENCES t1 (f1)) ENGINE=InnoDB WITH SYSTEM VERSIONING;
+SET FOREIGN_KEY_CHECKS= OFF;
+INSERT IGNORE INTO t2 VALUES (1);
+SET FOREIGN_KEY_CHECKS= ON;
+UPDATE t2 SET f2= 2;
+ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`f2`) REFERENCES `t1` (`f1`))
+DELETE FROM t2;
+DROP TABLE t2, t1;
diff --git a/mysql-test/suite/versioning/t/foreign.test b/mysql-test/suite/versioning/t/foreign.test
index 566d481c2a8..075f15a216c 100644
--- a/mysql-test/suite/versioning/t/foreign.test
+++ b/mysql-test/suite/versioning/t/foreign.test
@@ -317,4 +317,18 @@ select count(*) from subchild;
drop table subchild, child, parent;
+CREATE TABLE t1 (f1 INT, KEY(f1)) ENGINE=InnoDB;
+CREATE TABLE t2 (f2 INT, FOREIGN KEY (f2) REFERENCES t1 (f1)) ENGINE=InnoDB WITH SYSTEM VERSIONING;
+
+SET FOREIGN_KEY_CHECKS= OFF;
+INSERT IGNORE INTO t2 VALUES (1);
+
+SET FOREIGN_KEY_CHECKS= ON;
+--error ER_NO_REFERENCED_ROW_2
+UPDATE t2 SET f2= 2;
+DELETE FROM t2;
+
+DROP TABLE t2, t1;
+
+
--source suite/versioning/common_finish.inc