summaryrefslogtreecommitdiff
path: root/mysql-test/t/sp.test
diff options
context:
space:
mode:
authorunknown <anozdrin/alik@alik.opbmk>2007-03-27 21:55:01 +0400
committerunknown <anozdrin/alik@alik.opbmk>2007-03-27 21:55:01 +0400
commit6a594ffd18f52b4bf825eed9714c94207235d22c (patch)
treefc43f9e275db5c513e8dee9c8c719dc0701586b7 /mysql-test/t/sp.test
parent21af9a55dd6b84b22e3ded4c8336330798bd225e (diff)
downloadmariadb-git-6a594ffd18f52b4bf825eed9714c94207235d22c.tar.gz
Fix for BUG#25082: default database change on trigger
execution breaks replication. When a stored routine is executed, we switch current database to the database, in which the routine has been created. When the stored routine finishes, we switch back to the original database. The problem was that if the original database does not exist (anymore) after routine execution, we raised an error. The fix is to report a warning, and switch to the NULL database. mysql-test/r/sp.result: Updated result file. mysql-test/t/sp.test: Added test case for BUG#25082. sql/mysql_priv.h: 1. Change mysql_change_db() prototype; 2. Polishing. sql/sp.cc: Polishing. sql/sp_head.cc: Polishing. sql/sql_db.cc: 1. Polishing. 2. Fix mysql_change_db(). sql/sql_parse.cc: Polishing. sql/sql_show.cc: Polishing.
Diffstat (limited to 'mysql-test/t/sp.test')
-rw-r--r--mysql-test/t/sp.test41
1 files changed, 41 insertions, 0 deletions
diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test
index fd158408fb6..6aab1ae3c6a 100644
--- a/mysql-test/t/sp.test
+++ b/mysql-test/t/sp.test
@@ -6929,6 +6929,47 @@ INSERT INTO t3 VALUES (1, 3.4), (1, 2), (1, 0.9), (2, 8), (2, 7)|
SELECT SUM(f2), bug25373(f1) FROM t3 GROUP BY bug25373(f1) WITH ROLLUP|
DROP FUNCTION bug25373|
DROP TABLE t3|
+
+
+#
+# BUG#25082: Default database change on trigger execution breaks replication.
+#
+# As it turned out, this bug has actually two bugs. So, here we have two test
+# cases -- one in sp.test, the other in sp-security.test.
+#
+
+#
+# Test case 1: error on dropping the current database.
+#
+
+# Prepare.
+
+--disable_warnings
+DROP DATABASE IF EXISTS mysqltest1|
+DROP DATABASE IF EXISTS mysqltest2|
+--enable_warnings
+
+CREATE DATABASE mysqltest1|
+CREATE DATABASE mysqltest2|
+
+# Test.
+
+CREATE PROCEDURE mysqltest1.p1()
+ DROP DATABASE mysqltest2|
+
+use mysqltest2|
+
+CALL mysqltest1.p1()|
+
+SELECT DATABASE()|
+
+# Cleanup.
+
+DROP DATABASE mysqltest1|
+
+use test|
+
+
#
# NOTE: The delimiter is `|`, and not `;`. It is changed to `;`
# at the end of the file!