Commit 47fc64c1 authored by Marko Mäkelä's avatar Marko Mäkelä

MDEV-32833 InnoDB wrong error message

trx_t::commit_in_memory(): Empty the detailed_error string, so that
FOREIGN KEY error messages from an earlier transaction will not be
wrongly reused in ha_innobase::get_error_message().

Reviewed by: Thirunarayanan Balathandayuthapani
parent 1fec5012
......@@ -236,3 +236,10 @@ INSERT INTO t2 VALUES('G', 3);
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`))
DROP TABLE t2, t1;
SET FOREIGN_KEY_CHECKS=DEFAULT;
CREATE TABLE t1(a SERIAL) ENGINE=InnoDB ROW_FORMAT=COMPRESSED PAGE_COMPRESSED=1;
ERROR HY000: Can't create table `test`.`t1` (errno: 140 "Wrong create options")
SHOW WARNINGS;
Level Code Message
Warning 140 InnoDB: PAGE_COMPRESSED table can't have ROW_TYPE=COMPRESSED
Error 1005 Can't create table `test`.`t1` (errno: 140 "Wrong create options")
Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB
......@@ -2481,7 +2481,7 @@ INSERT INTO t2 VALUES(1);
DELETE FROM t1 WHERE id = 1;
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `c1` FOREIGN KEY (`v`) REFERENCES `t1` (`id`))
DROP TABLE t1;
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `c1` FOREIGN KEY (`v`) REFERENCES `t1` (`id`))
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails
SET FOREIGN_KEY_CHECKS=0;
DROP TABLE t1;
SET FOREIGN_KEY_CHECKS=1;
......
......@@ -268,3 +268,7 @@ SET FOREIGN_KEY_CHECKS=1;
INSERT INTO t2 VALUES('G', 3);
DROP TABLE t2, t1;
SET FOREIGN_KEY_CHECKS=DEFAULT;
--error ER_CANT_CREATE_TABLE
CREATE TABLE t1(a SERIAL) ENGINE=InnoDB ROW_FORMAT=COMPRESSED PAGE_COMPRESSED=1;
SHOW WARNINGS;
......@@ -1054,6 +1054,7 @@ struct trx_t {
{
ut_ad(state == TRX_STATE_NOT_STARTED);
ut_ad(!id);
ut_ad(!*detailed_error);
ut_ad(!has_logged());
ut_ad(!is_referenced());
ut_ad(!is_wsrep());
......
......@@ -1471,6 +1471,7 @@ inline void trx_t::commit_in_memory(const mtr_t *mtr)
DBUG_LOG("trx", "Commit in memory: " << this);
state= TRX_STATE_NOT_STARTED;
*detailed_error= '\0';
assert_freed();
trx_init(this);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment