summaryrefslogtreecommitdiff
path: root/mysql-test/t/sp-prelocking.test
diff options
context:
space:
mode:
authordlenev@mysql.com <>2006-06-21 01:50:20 +0400
committerdlenev@mysql.com <>2006-06-21 01:50:20 +0400
commitb75254e101459fd472f015e871b228c8c2d350a6 (patch)
tree47d48c79ace5fcdbac5cd5c1f69187657896bc25 /mysql-test/t/sp-prelocking.test
parent94019aed9f2f39358333edf8fcad334200709e31 (diff)
downloadmariadb-git-b75254e101459fd472f015e871b228c8c2d350a6.tar.gz
Fix for bug#19634 "Re-execution of multi-delete which involve trigger/stored
function crashes server". Attempts to execute prepared multi-delete statement which involved trigger or stored function caused server crashes (the same happened for such statements included in stored procedures in cases when one tried to execute them more than once). The problem was caused by yet another incorrect usage of check_table_access() routine (the latter assumes that table list which it gets as argument corresponds to value LEX::query_tables_own_last). We solve this problem by juggling with LEX::query_tables_own_last value when we call check_table_access() for LEX::auxilliary_table_list (better solution is too intrusive and should be done in 5.1).
Diffstat (limited to 'mysql-test/t/sp-prelocking.test')
-rw-r--r--mysql-test/t/sp-prelocking.test31
1 files changed, 31 insertions, 0 deletions
diff --git a/mysql-test/t/sp-prelocking.test b/mysql-test/t/sp-prelocking.test
index a7215462afb..b94de6236d3 100644
--- a/mysql-test/t/sp-prelocking.test
+++ b/mysql-test/t/sp-prelocking.test
@@ -272,3 +272,34 @@ drop table t1;
drop view v1, v2, v3;
drop function bug15683;
+
+#
+# Bug#19634 "Re-execution of multi-delete which involve trigger/stored
+# function crashes server"
+#
+--disable_warnings
+drop table if exists t1, t2, t3;
+drop function if exists bug19634;
+--enable_warnings
+create table t1 (id int, data int);
+create table t2 (id int);
+create table t3 (data int);
+create function bug19634() returns int return (select count(*) from t3);
+prepare stmt from "delete t1 from t1, t2 where t1.id = t2.id and bug19634()";
+# This should not crash server
+execute stmt;
+execute stmt;
+deallocate prepare stmt;
+
+create trigger t1_bi before delete on t1 for each row insert into t3 values (old.data);
+prepare stmt from "delete t1 from t1, t2 where t1.id = t2.id";
+
+execute stmt;
+execute stmt;
+deallocate prepare stmt;
+
+drop function bug19634;
+drop table t1, t2, t3;
+
+
+--echo End of 5.0 tests