diff options
author | kostja@bodhi.(none) <> | 2007-07-05 02:20:32 +0400 |
---|---|---|
committer | kostja@bodhi.(none) <> | 2007-07-05 02:20:32 +0400 |
commit | c3f37e0b3df9b00ff386cc622e4d71ee3f852da2 (patch) | |
tree | e075072a888e58c0455a6e257bc19c035e9cb24a /mysql-test/r | |
parent | 674d10270c92c15cb204ec5cc87f2f5d06195184 (diff) | |
download | mariadb-git-c3f37e0b3df9b00ff386cc622e4d71ee3f852da2.tar.gz |
A fix and a teset case for Bug#28551 The warning
'No database selected' is reported when calling stored procedures
Remove the offending warning introduced by the fix for Bug
25082
This minimal patch relies on the intrinsic knowledge of the fact that
mysql_change_db is never called with 'force_switch' set to TRUE
when such a warning may be needed:
* every stored routine belongs to a database (unlike, e.g., a
user defined function, which does not), so if we're activating the
database of a stored routine, it can never be NULL.
Therefore, this branch is never called for activation.
* if we're restoring the 'old' current database after routine
execution is complete, we should not issue a warning, since it's OK to
call a routine without having previously selected the current database.
TODO: 'force_switch' is an ambiguous flag, since we do not actually
have to 'force' the switch in case of stored routines at all.
When we activate the routine's database, we should perform
all the checks as in case of 'use db', and so we already do (in this
case 'force_switch' is unused).
When we load a routine into cache, we should not use mysql_change_db
at all, since there it's enough to call thd->reset_db(). We
do it this way for triggers, but code for routines is different (wrongly).
TODO: bugs are lurking in replication, since it bypasses mysql_change_db
and calls thd->[re_]set_db to set the current database.
The latter does not change thd->db_charset, thd->sctx->db_access
and thd->variables.collation_database (and this may have nasty side
effects).
These todo items are to be addressed in a separate patch, if at all.
Diffstat (limited to 'mysql-test/r')
-rw-r--r-- | mysql-test/r/sp.result | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/mysql-test/r/sp.result b/mysql-test/r/sp.result index b411c65faee..5d7371b0991 100644 --- a/mysql-test/r/sp.result +++ b/mysql-test/r/sp.result @@ -6176,4 +6176,11 @@ v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VI DROP VIEW v1; DROP FUNCTION metered; DROP TABLE t1; +drop database if exists mysqltest_db1; +create database mysqltest_db1; +create procedure mysqltest_db1.sp_bug28551() begin end; +call mysqltest_db1.sp_bug28551(); +show warnings; +Level Code Message +drop database mysqltest_db1; End of 5.0 tests |