summaryrefslogtreecommitdiff
path: root/mysql-test/t/trigger.test
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test/t/trigger.test')
-rw-r--r--mysql-test/t/trigger.test43
1 files changed, 43 insertions, 0 deletions
diff --git a/mysql-test/t/trigger.test b/mysql-test/t/trigger.test
index 57b5431fa1b..c1ff9b58e14 100644
--- a/mysql-test/t/trigger.test
+++ b/mysql-test/t/trigger.test
@@ -2334,4 +2334,47 @@ SELECT * FROM t2;
DROP TABLE t1, t2;
+--echo #
+--echo # Bug#51650 crash with user variables and triggers
+--echo #
+
+--disable_warnings
+DROP TRIGGER IF EXISTS trg1;
+DROP TABLE IF EXISTS t1, t2;
+--enable_warnings
+
+CREATE TABLE t1 (b VARCHAR(50) NOT NULL);
+CREATE TABLE t2 (a VARCHAR(10) NOT NULL DEFAULT '');
+
+delimiter //;
+CREATE TRIGGER trg1 AFTER INSERT ON t2
+FOR EACH ROW BEGIN
+ SELECT 1 FROM t1 c WHERE
+ (@bug51650 IS NULL OR @bug51650 != c.b) AND c.b = NEW.a LIMIT 1 INTO @foo;
+END//
+delimiter ;//
+
+SET @bug51650 = 1;
+INSERT IGNORE INTO t2 VALUES();
+INSERT IGNORE INTO t1 SET b = '777';
+INSERT IGNORE INTO t2 SET a = '111';
+SET @bug51650 = 1;
+INSERT IGNORE INTO t2 SET a = '777';
+
+DROP TRIGGER trg1;
+DROP TABLE t1, t2;
+
+#
+# Bug #48525: trigger changes "Column 'id' cannot be null" behaviour
+#
+CREATE TABLE t1 (id INT NOT NULL);
+CREATE TABLE t2 (id INT NOT NULL);
+INSERT t1 VALUES (1),(2),(3);
+UPDATE t1 SET id=NULL;
+CREATE TRIGGER t1_bu BEFORE UPDATE ON t1 FOR EACH ROW
+ INSERT INTO t2 VALUES (3);
+UPDATE t1 SET id=NULL;
+DROP TRIGGER t1_bu;
+DROP TABLE t1,t2;
+
--echo End of 5.1 tests.