diff options
author | unknown <dlenev@brandersnatch.localdomain> | 2005-04-07 01:40:29 +0400 |
---|---|---|
committer | unknown <dlenev@brandersnatch.localdomain> | 2005-04-07 01:40:29 +0400 |
commit | 188b8af60c044b1ecbcd5009ea63445ae5725f0a (patch) | |
tree | f5949f98b1b44d078b897c9beeb2a04de8a055fd /sql/sp.cc | |
parent | d30aa11c1ac35ae1594d6c772925c70ffc14166f (diff) | |
download | mariadb-git-188b8af60c044b1ecbcd5009ea63445ae5725f0a.tar.gz |
Fix for bug #9566 "explicit LOCK TABLE and store procedures result in
illegal state".
We should not assume that mysql.proc table does not exist if we are
unable to open it under LOCK TABLES or in prelocked mode (and
remember this fact by setting mysql_proc_table_exists to zero).
mysql-test/r/sp.result:
Added test for bug #9566 "explicit LOCK TABLE and store procedures result in illegal
state"
mysql-test/t/sp.test:
Added test for bug #9566 "explicit LOCK TABLE and store procedures result in illegal
state"
sql/sp.cc:
db_find_routine_aux():
We should not assume that mysql.proc table does not exist if we are
unable to open it under LOCK TABLES or in prelocked mode since this
condition may be transient.
Diffstat (limited to 'sql/sp.cc')
-rw-r--r-- | sql/sp.cc | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/sql/sp.cc b/sql/sp.cc index 23d389cd299..1956f32f2c6 100644 --- a/sql/sp.cc +++ b/sql/sp.cc @@ -70,9 +70,8 @@ db_find_routine_aux(THD *thd, int type, sp_name *name, type, name->m_name.length, name->m_name.str)); /* - Speed up things if mysql.proc doesn't exists - mysql_proc_table_exists is set when on creates a stored procedure - or on flush privileges + Speed up things if mysql.proc doesn't exists. mysql_proc_table_exists + is set when we create or read stored procedure or on flush privileges. */ if (!mysql_proc_table_exists && ltype == TL_READ) DBUG_RETURN(SP_OPEN_TABLE_FAILED); @@ -98,7 +97,13 @@ db_find_routine_aux(THD *thd, int type, sp_name *name, if (! (table= open_ltable(thd, &tables, ltype))) { *tablep= NULL; - mysql_proc_table_exists= 0; + /* + Under explicit LOCK TABLES or in prelocked mode we should not + say that mysql.proc table does not exist if we are unable to + open it since this condition may be transient. + */ + if (!(thd->locked_tables || thd->prelocked_mode)) + mysql_proc_table_exists= 0; DBUG_RETURN(SP_OPEN_TABLE_FAILED); } *opened= TRUE; |