diff options
author | unknown <anozdrin/alik@quad.> | 2008-03-12 16:13:33 +0300 |
---|---|---|
committer | unknown <anozdrin/alik@quad.> | 2008-03-12 16:13:33 +0300 |
commit | 326c4e90589dd87792eacfa6e8746bc486a10ba0 (patch) | |
tree | 949c8a892915fb127195051b1d08b313100f7a6b /mysql-test/r/trigger-trans.result | |
parent | aafb492d594776ead1014163461d30cbf9ca5772 (diff) | |
download | mariadb-git-326c4e90589dd87792eacfa6e8746bc486a10ba0.tar.gz |
A fix for Bug#34643: TRUNCATE crash if trigger and foreign key.
In cases when TRUNCATE was executed by invoking mysql_delete() rather
than by table recreation (for example, when TRUNCATE was issued on
InnoDB table with is referenced by foreign key) triggers were invoked.
In debug builds this also led to crash because of an assertion, which
assumes that some preliminary actions take place before trigger
invocation, which doesn't happen in case of TRUNCATE.
The fix is not to execute triggers in mysql_delete() when this
function is used by TRUNCATE.
mysql-test/r/trigger-trans.result:
Update result file.
mysql-test/t/trigger-trans.test:
A test case for Bug#34643: TRUNCATE crash if trigger and foreign key.
sql/sql_delete.cc:
Do not process triggers in TRUNCATE.
Diffstat (limited to 'mysql-test/r/trigger-trans.result')
-rw-r--r-- | mysql-test/r/trigger-trans.result | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/mysql-test/r/trigger-trans.result b/mysql-test/r/trigger-trans.result index cd5f629564f..dccaa27c5fd 100644 --- a/mysql-test/r/trigger-trans.result +++ b/mysql-test/r/trigger-trans.result @@ -140,4 +140,23 @@ select * from t3; c 1 drop table t1, t2, t3; +DROP TABLE IF EXISTS t1; +DROP TABLE IF EXISTS t2; +CREATE TABLE t1(a INT PRIMARY KEY) ENGINE=innodb; +CREATE TABLE t2(b INT, FOREIGN KEY(b) REFERENCES t1(a)) ENGINE=innodb; +INSERT INTO t1 VALUES (1); +CREATE TRIGGER t1_bd BEFORE DELETE ON t1 FOR EACH ROW SET @a = 1; +CREATE TRIGGER t1_ad AFTER DELETE ON t1 FOR EACH ROW SET @b = 1; +SET @a = 0; +SET @b = 0; +TRUNCATE t1; +SELECT @a, @b; +@a @b +0 0 +INSERT INTO t1 VALUES (1); +DELETE FROM t1; +SELECT @a, @b; +@a @b +1 1 +DROP TABLE t2, t1; End of 5.0 tests |