summaryrefslogtreecommitdiff
path: root/mysql-test/t/sp-error.test
diff options
context:
space:
mode:
authorunknown <pem@mysql.comhem.se>2004-09-08 14:23:14 +0200
committerunknown <pem@mysql.comhem.se>2004-09-08 14:23:14 +0200
commitc92b5349701ba68fa7ab97abf14933de8d6352fe (patch)
treebf5ec7b5d6fd4a091b16a9fb6c6ca68cc5d2c22b /mysql-test/t/sp-error.test
parent1bf3ce01c48f980c183a8b88afdc0440a26da36d (diff)
downloadmariadb-git-c92b5349701ba68fa7ab97abf14933de8d6352fe.tar.gz
Fixed BUG#5000: SPs can be created with no default database.
Easy to prevent crash, but the question was how to treat this case? We ended up implementing the "global" SPs (i.e. with no associated db), which were planned but left unresolved when SPs moved into dbs. So now things like "call .p()" work too. mysql-test/r/sp-error.result: New test case for BUG#5000, and "global" SPs in general. mysql-test/t/sp-error.test: New test case for BUG#5000, and "global" SPs in general. sql/sp.cc: Prevent crash when the new db is null. sql/sp_head.cc: Don't set the db part of the name to thd->db, we have already set it correctly in the provided name struct. Also, don't attempt to change "no-db" when executing an SP. sql/sql_yacc.yy: Added support for the "global SP" syntax, e.g ".p()".
Diffstat (limited to 'mysql-test/t/sp-error.test')
-rw-r--r--mysql-test/t/sp-error.test23
1 files changed, 23 insertions, 0 deletions
diff --git a/mysql-test/t/sp-error.test b/mysql-test/t/sp-error.test
index f8abab0e7e3..d946ba7afbc 100644
--- a/mysql-test/t/sp-error.test
+++ b/mysql-test/t/sp-error.test
@@ -5,6 +5,29 @@
# Make sure we don't have any procedures left.
delete from mysql.proc;
+# A test "global" procedures, i.e. not belonging to any database.
+create function .f1() returns int return 1;
+create procedure .p1() select 1, database();
+create procedure p1() select 2, database();
+
+alter procedure .p1 sql security invoker;
+
+# This is ok:
+select .f1();
+call .p1();
+call p1();
+
+# This is not ok:
+--error 1304
+select f1();
+
+select db,name,type,security_type from mysql.proc;
+
+drop function .f1;
+drop procedure .p1;
+drop procedure p1;
+
+
delimiter |;
# This should give three syntax errors (sometimes crashed; bug #643)