diff --git a/mysql-test/suite/innodb/r/temporary_table.result b/mysql-test/suite/innodb/r/temporary_table.result
index 310741b..64eb327 100644
--- a/mysql-test/suite/innodb/r/temporary_table.result
+++ b/mysql-test/suite/innodb/r/temporary_table.result
@@ -638,3 +638,15 @@ t1	CREATE TEMPORARY TABLE `t1` (
   `j` int(11) DEFAULT NULL,
   PRIMARY KEY (`i`) KEY_BLOCK_SIZE=8
 ) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC
+DROP TABLE t1;
+CREATE TEMPORARY TABLE t1(f1 INT, KEY(f1)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES(NULL);
+UPDATE t1 SET f1 = 0;
+START TRANSACTION;
+UPDATE t1 SET f1 = 4;
+UPDATE t1 SET f1 = 0;
+ROLLBACK;
+SELECT * FROM t1;
+f1
+0
+DROP TABLE t1;
diff --git a/mysql-test/suite/innodb/t/temporary_table.test b/mysql-test/suite/innodb/t/temporary_table.test
index 4184daa..9a64065 100644
--- a/mysql-test/suite/innodb/t/temporary_table.test
+++ b/mysql-test/suite/innodb/t/temporary_table.test
@@ -464,3 +464,14 @@ ALTER TABLE t1 ROW_FORMAT = DYNAMIC;
 set innodb_strict_mode = ON;
 ALTER TABLE t1 ADD COLUMN j INT;
 SHOW CREATE TABLE t1;
+DROP TABLE t1;
+
+CREATE TEMPORARY TABLE t1(f1 INT, KEY(f1)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES(NULL);
+UPDATE t1 SET f1 = 0;
+START TRANSACTION;
+UPDATE t1 SET f1 = 4;
+UPDATE t1 SET f1 = 0;
+ROLLBACK;
+SELECT * FROM t1;
+DROP TABLE t1;
diff --git a/storage/innobase/row/row0umod.cc b/storage/innobase/row/row0umod.cc
index d3aa6f8..41ba66f 100644
--- a/storage/innobase/row/row0umod.cc
+++ b/storage/innobase/row/row0umod.cc
@@ -540,8 +540,8 @@ row_undo_mod_del_mark_or_remove_sec_low(
 
 	/* For temporary table, we can skip to check older version of
 	clustered index entry, because there is no MVCC or purge. */
-	if (!node->table->is_temporary()
-	    && row_vers_old_has_index_entry(
+	if (node->table->is_temporary()
+	    || row_vers_old_has_index_entry(
 		    FALSE, btr_pcur_get_rec(&node->pcur),
 		    &mtr_vers, index, entry, 0, 0)) {
 		err = btr_cur_del_mark_set_sec_rec(BTR_NO_LOCKING_FLAG,
