~ubuntu-branches/ubuntu/hardy/mysql-dfsg-5.0/hardy-updates

« back to all changes in this revision

Viewing changes to mysql-test/t/trigger.test

  • Committer: Bazaar Package Importer
  • Author(s): sean finney
  • Date: 2007-05-13 12:32:45 UTC
  • mfrom: (1.1.11 upstream)
  • Revision ID: james.westby@ubuntu.com-20070513123245-8c3l187dk34cz2ar
Tags: 5.0.41-2
the previous "translation changes" inadvertently introduced unrelated
changes in the package control file.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1699
1699
DROP PROCEDURE bug22580_proc_1;
1700
1700
DROP PROCEDURE bug22580_proc_2;
1701
1701
 
 
1702
#
 
1703
# Bug#27006: AFTER UPDATE triggers not fired with INSERT ... ON DUPLICATE
 
1704
#
 
1705
--disable_warnings
 
1706
DROP TRIGGER IF EXISTS trg27006_a_update;
 
1707
DROP TRIGGER IF EXISTS trg27006_a_insert;
 
1708
--enable_warnings
 
1709
 
 
1710
CREATE TABLE t1 (
 
1711
  `id` int(10) unsigned NOT NULL auto_increment,
 
1712
  `val` varchar(10) NOT NULL,
 
1713
  PRIMARY KEY  (`id`)
 
1714
);
 
1715
CREATE TABLE t2 like t1;
 
1716
DELIMITER |;
 
1717
 
 
1718
CREATE TRIGGER trg27006_a_insert AFTER INSERT ON t1 FOR EACH ROW
 
1719
BEGIN
 
1720
    insert into t2 values (NULL,new.val);
 
1721
END |
 
1722
CREATE TRIGGER trg27006_a_update AFTER UPDATE ON t1 FOR EACH ROW
 
1723
BEGIN
 
1724
    insert into t2 values (NULL,new.val);
 
1725
END |
 
1726
DELIMITER ;|
 
1727
 
 
1728
INSERT INTO t1(val) VALUES ('test1'),('test2');
 
1729
SELECT * FROM t1;
 
1730
SELECT * FROM t2;
 
1731
INSERT INTO t1 VALUES (2,'test2') ON DUPLICATE KEY UPDATE val=VALUES(val);
 
1732
INSERT INTO t1 VALUES (2,'test3') ON DUPLICATE KEY UPDATE val=VALUES(val);
 
1733
INSERT INTO t1 VALUES (3,'test4') ON DUPLICATE KEY UPDATE val=VALUES(val);
 
1734
SELECT * FROM t1;
 
1735
SELECT * FROM t2;
 
1736
DROP TRIGGER trg27006_a_insert;
 
1737
DROP TRIGGER trg27006_a_update;
 
1738
drop table t1,t2;
 
1739
 
1702
1740
--echo End of 5.0 tests