diff options
author | unknown <evgen@moonbone.local> | 2007-03-16 17:23:26 +0300 |
---|---|---|
committer | unknown <evgen@moonbone.local> | 2007-03-16 17:23:26 +0300 |
commit | 6d93f15039d551f291232c1b60527b00cd9c6bc9 (patch) | |
tree | d4d4df4bcb01b8fe3d02056fdf3b0b15e53b3a3c /mysql-test/t/trigger.test | |
parent | 43b9ff1b21b2d645e5cd52d82878a48b47b01f8d (diff) | |
download | mariadb-git-6d93f15039d551f291232c1b60527b00cd9c6bc9.tar.gz |
Bug#27006: AFTER UPDATE triggers not fired with INSERT ... ON DUPLICATE KEY
UPDATE if the row wasn't actually changed.
This bug was caused by fix for bug#19978. It causes AFTER UPDATE triggers
not firing if a row wasn't actually changed by the update part of the
INSERT .. ON DUPLICATE KEY UPDATE.
Now triggers are always fired if a row is touched by the INSERT ... ON
DUPLICATE KEY UPDATE.
sql/sql_insert.cc:
Bug#27006: AFTER UPDATE triggers not fired with INSERT ... ON DUPLICATE KEY
UPDATE if the row wasn't actually changed.
Now triggers are always fired if a row is touched by the INSERT ... ON
DUPLICATE KEY UPDATE.
mysql-test/r/trigger.result:
Added a test case for the bug#27006: AFTER UPDATE triggers not fired with INSERT ... ON DUPLICATE KEY
UPDATE if the row wasn't actually changed.
mysql-test/t/trigger.test:
Added a test case for the bug#27006: AFTER UPDATE triggers not fired with INSERT ... ON DUPLICATE KEY
UPDATE if the row wasn't actually changed.
Diffstat (limited to 'mysql-test/t/trigger.test')
-rw-r--r-- | mysql-test/t/trigger.test | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/mysql-test/t/trigger.test b/mysql-test/t/trigger.test index 5c95004c901..49b7b527bd9 100644 --- a/mysql-test/t/trigger.test +++ b/mysql-test/t/trigger.test @@ -1699,4 +1699,42 @@ DROP TABLE bug22580_t1; DROP PROCEDURE bug22580_proc_1; DROP PROCEDURE bug22580_proc_2; +# +# Bug#27006: AFTER UPDATE triggers not fired with INSERT ... ON DUPLICATE KEY +# UPDATE if the row wasn't actually changed. +# +--disable_warnings +DROP TRIGGER IF EXISTS trg27006_a_update; +DROP TRIGGER IF EXISTS trg27006_a_insert; +--enable_warnings + +CREATE TABLE t1 ( + `id` int(10) unsigned NOT NULL auto_increment, + `val` varchar(10) NOT NULL, + PRIMARY KEY (`id`) +); +CREATE TABLE t2 like t1; +DELIMITER |; + +CREATE TRIGGER trg27006_a_insert AFTER INSERT ON t1 FOR EACH ROW +BEGIN + insert into t2 values (NULL,new.val); +END | +CREATE TRIGGER trg27006_a_update AFTER UPDATE ON t1 FOR EACH ROW +BEGIN + insert into t2 values (NULL,new.val); +END | +DELIMITER ;| + +INSERT INTO t1(val) VALUES ('test1'),('test2'); +SELECT * FROM t1; +SELECT * FROM t2; +INSERT INTO t1 VALUES (2,'test2') ON DUPLICATE KEY UPDATE val=VALUES(val); +INSERT INTO t1 VALUES (3,'test3') ON DUPLICATE KEY UPDATE val=VALUES(val); +SELECT * FROM t1; +SELECT * FROM t2; +DROP TRIGGER trg27006_a_insert; +DROP TRIGGER trg27006_a_update; +drop table t1,t2; + --echo End of 5.0 tests |