summaryrefslogtreecommitdiff
path: root/mysql-test/t/trigger.test
diff options
context:
space:
mode:
authorunknown <gkodinov/kgeorge@macbook.gmz>2007-01-23 12:34:50 +0200
committerunknown <gkodinov/kgeorge@macbook.gmz>2007-01-23 12:34:50 +0200
commit276f0d4c5e4733d0953ed0fa7d696ccbe3ee89e0 (patch)
treeef50ee2680b393a9652b2c98dfe15de22de7f795 /mysql-test/t/trigger.test
parent4b2c3ac40d392b6027b8360b22bbe52d80b2e82a (diff)
parent6447a7b6f2c45a16b24b18d5910036aeb514849c (diff)
downloadmariadb-git-276f0d4c5e4733d0953ed0fa7d696ccbe3ee89e0.tar.gz
Merge macbook.gmz:/Users/kgeorge/mysql/work/mysql-5.0-opt
into macbook.gmz:/Users/kgeorge/mysql/work/merge-5.1-opt mysql-test/r/func_in.result: Auto merged mysql-test/r/range.result: Auto merged mysql-test/r/select.result: Auto merged mysql-test/r/sp-code.result: Auto merged mysql-test/r/trigger.result: Auto merged mysql-test/r/udf.result: Auto merged mysql-test/r/view.result: Auto merged mysql-test/t/func_in.test: Auto merged mysql-test/t/func_str.test: Auto merged mysql-test/t/range.test: Auto merged mysql-test/t/select.test: Auto merged mysql-test/t/trigger.test: Auto merged mysql-test/t/udf.test: Auto merged sql/item.cc: Auto merged sql/item.h: Auto merged sql/item_cmpfunc.cc: Auto merged sql/item_func.cc: Auto merged sql/item_strfunc.cc: Auto merged sql/mysql_priv.h: Auto merged sql/opt_range.h: Auto merged sql/sql_base.cc: Auto merged sql/sql_delete.cc: Auto merged sql/sql_insert.cc: Auto merged sql/sql_lex.cc: Auto merged sql/sql_lex.h: Auto merged sql/sql_prepare.cc: Auto merged sql/sql_select.cc: Auto merged sql/sql_table.cc: Auto merged sql/sql_union.cc: Auto merged sql/sql_update.cc: Auto merged mysql-test/r/func_str.result: merge 5.0-opt -> 5.1-opt mysql-test/r/group_by.result: merge 5.0-opt -> 5.1-opt mysql-test/r/insert.result: merge 5.0-opt -> 5.1-opt mysql-test/r/subselect.result: merge 5.0-opt -> 5.1-opt mysql-test/t/group_by.test: merge 5.0-opt -> 5.1-opt mysql-test/t/insert.test: merge 5.0-opt -> 5.1-opt mysql-test/t/subselect.test: merge 5.0-opt -> 5.1-opt mysql-test/t/view.test: merge 5.0-opt -> 5.1-opt sql/item_cmpfunc.h: merge 5.0-opt -> 5.1-opt sql/item_strfunc.h: merge 5.0-opt -> 5.1-opt
Diffstat (limited to 'mysql-test/t/trigger.test')
-rw-r--r--mysql-test/t/trigger.test46
1 files changed, 46 insertions, 0 deletions
diff --git a/mysql-test/t/trigger.test b/mysql-test/t/trigger.test
index 916a85ec424..3d60549d55b 100644
--- a/mysql-test/t/trigger.test
+++ b/mysql-test/t/trigger.test
@@ -1548,4 +1548,50 @@ select * from t1;
drop table t1;
+#
+# Bug#25398: crash when a trigger contains a SELECT with
+# trigger fields in the select list under DISTINCT
+#
+
+CREATE TABLE t1 (
+ id int NOT NULL DEFAULT '0',
+ a varchar(10) NOT NULL,
+ b varchar(10),
+ c varchar(10),
+ d timestamp NOT NULL,
+ PRIMARY KEY (id, a)
+);
+
+CREATE TABLE t2 (
+ fubar_id int unsigned NOT NULL DEFAULT '0',
+ last_change_time datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+ PRIMARY KEY (fubar_id)
+);
+
+DELIMITER |;
+
+CREATE TRIGGER fubar_change
+ AFTER UPDATE ON t1
+ FOR EACH ROW
+ BEGIN
+ INSERT INTO t2 (fubar_id, last_change_time)
+ SELECT DISTINCT NEW.id AS fubar_id, NOW() AS last_change_time
+ FROM t1 WHERE (id = NEW.id) AND (OLD.c != NEW.c)
+ ON DUPLICATE KEY UPDATE
+ last_change_time =
+ IF((fubar_id = NEW.id)AND(OLD.c != NEW.c),NOW(),last_change_time);
+ END
+|
+
+DELIMITER ;|
+
+INSERT INTO t1 (id,a, b,c,d) VALUES
+ (1,'a','b','c',now()),(2,'a','b','c',now());
+
+UPDATE t1 SET c='Bang!' WHERE id=1;
+
+SELECT fubar_id FROM t2;
+
+DROP TABLE t1,t2;
+
--echo End of 5.0 tests