summaryrefslogtreecommitdiff
path: root/mysql-test/r/trigger.result
diff options
context:
space:
mode:
authorDavi Arnaut <Davi.Arnaut@Sun.COM>2010-03-09 18:55:08 -0300
committerDavi Arnaut <Davi.Arnaut@Sun.COM>2010-03-09 18:55:08 -0300
commit02ac873ccfb5deb46533aefd35640a95f51d1c67 (patch)
tree6e80e0d206fc3bbdd80786379064a055c0c9643a /mysql-test/r/trigger.result
parentfd35fc4ea228f38af35d065214fd002b0c09cb71 (diff)
downloadmariadb-git-02ac873ccfb5deb46533aefd35640a95f51d1c67.tar.gz
Bug#51650: crash with user variables and triggers
The problem was that bits of the destructive equality propagation optimization weren't being undone after the execution of a stored program. Modifications to the parse tree that are based on transient properties must be undone to enable the re-execution of stored programs. The solution is to cleanup any references to predicates generated by the equality propagation during the execution of a stored program. mysql-test/r/trigger.result: Add test case result for Bug#51650. mysql-test/t/trigger.test: Add test case for Bug#51650. sql/item.cc: Remove reference to a equality predicate.
Diffstat (limited to 'mysql-test/r/trigger.result')
-rw-r--r--mysql-test/r/trigger.result24
1 files changed, 24 insertions, 0 deletions
diff --git a/mysql-test/r/trigger.result b/mysql-test/r/trigger.result
index 4476735735c..5758f5b93d7 100644
--- a/mysql-test/r/trigger.result
+++ b/mysql-test/r/trigger.result
@@ -2087,4 +2087,28 @@ ERROR 42S02: Table 'test.a_nonextisting_table' doesn't exist
SELECT * FROM t2;
a b
DROP TABLE t1, t2;
+#
+# Bug#51650 crash with user variables and triggers
+#
+DROP TRIGGER IF EXISTS trg1;
+DROP TABLE IF EXISTS t1, t2;
+CREATE TABLE t1 (b VARCHAR(50) NOT NULL);
+CREATE TABLE t2 (a VARCHAR(10) NOT NULL DEFAULT '');
+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//
+SET @bug51650 = 1;
+INSERT IGNORE INTO t2 VALUES();
+Warnings:
+Warning 1329 No data - zero rows fetched, selected, or processed
+INSERT IGNORE INTO t1 SET b = '777';
+INSERT IGNORE INTO t2 SET a = '111';
+Warnings:
+Warning 1329 No data - zero rows fetched, selected, or processed
+SET @bug51650 = 1;
+INSERT IGNORE INTO t2 SET a = '777';
+DROP TRIGGER trg1;
+DROP TABLE t1, t2;
End of 5.1 tests.