summaryrefslogtreecommitdiff
path: root/mysql-test/r
diff options
context:
space:
mode:
authorunknown <kroki/tomash@moonlight.intranet>2006-09-12 14:56:25 +0400
committerunknown <kroki/tomash@moonlight.intranet>2006-09-12 14:56:25 +0400
commitd4933af87efb8f7b01d48c4ba46ff196f73a193f (patch)
tree36daf9e8f0c11911e6977b23b21f1e897d5bfe86 /mysql-test/r
parent33294b1b50eb20e09db5f1462a12fe5668f4f097 (diff)
downloadmariadb-git-d4933af87efb8f7b01d48c4ba46ff196f73a193f.tar.gz
BUG#21414: SP: Procedure undroppable, to some extent
The problem was that if after FLUSH TABLES WITH READ LOCK the user issued DROP/ALTER PROCEDURE/FUNCTION the operation would fail (as expected), but after UNLOCK TABLE any attempt to execute the same operation would lead to the error 1305 "PROCEDURE/FUNCTION does not exist", and an attempt to execute any stored function will also fail. This happened because under FLUSH TABLES WITH READ LOCK we couldn't open and lock mysql.proc table for update, and this fact was erroneously remembered by setting mysql_proc_table_exists to false, so subsequent statements believed that mysql.proc doesn't exist, and thus that there are no functions and procedures in the database. As a solution, we remove mysql_proc_table_exists flag completely. The reason is that this optimization didn't work most of the time anyway. Even if open of mysql.proc failed for some reason when we were trying to call a function or a procedure, we were setting mysql_proc_table_exists back to true to force table reopen for the sake of producing the same error message (the open can fail for number of reasons). The solution could have been to remember the reason why open failed, but that's a lot of code for optimization of a rare case. Hence we simply remove this optimization. mysql-test/r/sp.result: Add result for bug#21414: SP: Procedure undroppable, to some extent. mysql-test/t/sp.test: Remove no longer relevant comment. Add test case for bug#21414: SP: Procedure undroppable, to some extent. sql/mysql_priv.h: Remove declaration of mysql_proc_table_exists. sql/sp.cc: Remove references to mysql_proc_table_exists. sql/sql_acl.cc: Remove reference to mysql_proc_table_exists.
Diffstat (limited to 'mysql-test/r')
-rw-r--r--mysql-test/r/sp.result8
1 files changed, 8 insertions, 0 deletions
diff --git a/mysql-test/r/sp.result b/mysql-test/r/sp.result
index 854935b071b..b08ce0528a3 100644
--- a/mysql-test/r/sp.result
+++ b/mysql-test/r/sp.result
@@ -5394,4 +5394,12 @@ Procedure sql_mode Create Procedure
bug21416 CREATE DEFINER=`root`@`localhost` PROCEDURE `bug21416`()
show create procedure bug21416
drop procedure bug21416|
+DROP PROCEDURE IF EXISTS bug21414|
+CREATE PROCEDURE bug21414() SELECT 1|
+FLUSH TABLES WITH READ LOCK|
+DROP PROCEDURE bug21414|
+ERROR HY000: Can't execute the query because you have a conflicting read lock
+UNLOCK TABLES|
+The following should succeed.
+DROP PROCEDURE bug21414|
drop table t1,t2;