diff options
author | unknown <anozdrin/alik@alik.opbmk> | 2007-03-27 21:55:01 +0400 |
---|---|---|
committer | unknown <anozdrin/alik@alik.opbmk> | 2007-03-27 21:55:01 +0400 |
commit | 6a594ffd18f52b4bf825eed9714c94207235d22c (patch) | |
tree | fc43f9e275db5c513e8dee9c8c719dc0701586b7 /sql/sp.cc | |
parent | 21af9a55dd6b84b22e3ded4c8336330798bd225e (diff) | |
download | mariadb-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 'sql/sp.cc')
-rw-r--r-- | sql/sp.cc | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/sql/sp.cc b/sql/sp.cc index 2bb13b02e14..506b0bcd92b 100644 --- a/sql/sp.cc +++ b/sql/sp.cc @@ -441,14 +441,14 @@ db_load_routine(THD *thd, int type, sp_name *name, sp_head **sphp, { sp_head *sp= newlex.sphead; - if (dbchanged && (ret= mysql_change_db(thd, old_db.str, 1))) + if (dbchanged && (ret= mysql_change_db(thd, &old_db, TRUE))) goto end; delete sp; ret= SP_PARSE_ERROR; } else { - if (dbchanged && (ret= mysql_change_db(thd, old_db.str, 1))) + if (dbchanged && (ret= mysql_change_db(thd, &old_db, TRUE))) goto end; *sphp= newlex.sphead; (*sphp)->set_definer(&definer_user_name, &definer_host_name); @@ -1896,7 +1896,7 @@ sp_use_new_db(THD *thd, LEX_STRING new_db, LEX_STRING *old_db, DBUG_RETURN(0); } - ret= mysql_change_db(thd, new_db.str, no_access_check); + ret= mysql_change_db(thd, &new_db, no_access_check); *dbchangedp= ret == 0; DBUG_RETURN(ret); |