summaryrefslogtreecommitdiff
path: root/mysql-test/t/trigger.test
diff options
context:
space:
mode:
authorIgor Babaev <igor@askmonty.org>2012-01-02 20:06:36 -0800
committerIgor Babaev <igor@askmonty.org>2012-01-02 20:06:36 -0800
commitcd55894a52b5b2bf4a740eb0f39d91d7a82f673c (patch)
tree1e484ab2f16bba999b1ce4bb2bdf3a204babc76e /mysql-test/t/trigger.test
parent7714496dc1c72d01fd214cb7737ca4216a982e0f (diff)
downloadmariadb-git-cd55894a52b5b2bf4a740eb0f39d91d7a82f673c.tar.gz
Fixed LP bug #910083.
The patch for bug 685411 erroneously removed a call of engine->set_thd() from Item_subselect::fix_fields().
Diffstat (limited to 'mysql-test/t/trigger.test')
-rw-r--r--mysql-test/t/trigger.test40
1 files changed, 40 insertions, 0 deletions
diff --git a/mysql-test/t/trigger.test b/mysql-test/t/trigger.test
index 8d84330ec44..4b261c9f023 100644
--- a/mysql-test/t/trigger.test
+++ b/mysql-test/t/trigger.test
@@ -2434,3 +2434,43 @@ select * from t2;
drop table t1,t2;
--echo End of 5.2 tests.
+
+--echo #
+--echo # BUG #910083: materialized subquery in a trigger
+--echo #
+
+SET @save_optimizer_switch=@@optimizer_switch;
+SET optimizer_switch='materialization=on';
+
+CREATE TABLE t1 (a int);
+CREATE TABLE t2 (b int);
+
+CREATE TRIGGER tr AFTER UPDATE ON t1 FOR EACH ROW
+ UPDATE t2 SET b = (SELECT COUNT(a) FROM t1);
+
+INSERT INTO t1
+ VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9);
+
+INSERT INTO t2
+ VALUES (0),(0),(0),(0),(0),(0),(0),(0),(0);
+
+send
+ UPDATE t1 SET a = 3;
+
+connect(con1,localhost,root,,);
+ SELECT COUNT(*) FROM t1;
+disconnect con1;
+
+connection default;
+reap;
+SELECT * FROM t2;
+UPDATE t1 SET a = 2;
+SELECT * FROM t2;
+
+SET optimizer_switch=@save_optimizer_switch;
+
+DROP TRIGGER tr;
+DROP TABLE t1, t2;
+
+--echo End of 5.3 tests.
+