summaryrefslogtreecommitdiff
path: root/sql/sql_parse.cc
diff options
context:
space:
mode:
authorunknown <guilhem@mysql.com>2005-11-10 17:50:51 +0100
committerunknown <guilhem@mysql.com>2005-11-10 17:50:51 +0100
commit5d9c8e9543b3e77f57aaddbcfa038ab72e504743 (patch)
tree9f5312705476f9f7218439c118f72bd97002bf5d /sql/sql_parse.cc
parent93607e351a2e5425cde17b83dc967d30c1028111 (diff)
downloadmariadb-git-5d9c8e9543b3e77f57aaddbcfa038ab72e504743.tar.gz
WL#2971 "change log-bin-trust-routine-creators=0 to apply only to functions".
Indeed now that stored procedures CALL is not binlogged, but instead the invoked substatements are, the restrictions applied by log-bin-trust-routine-creators=0 are superfluous for procedures. They still need to apply to functions where function calls are written to the binlog (for example as "DO myfunc(3)"). We rename the variable to log-bin-trust-function-creators but allow the old name until some future version (and issue a warning if old name is used). mysql-test/mysql-test-run.pl: update to new option name mysql-test/mysql-test-run.sh: update to new option name mysql-test/mysql_test_run_new.c: update to new option name mysql-test/r/rpl_sp.result: result update mysql-test/t/rpl_sp-slave.opt: we need to skip this error to not hit BUG#14769 mysql-test/t/rpl_sp.test: Test update: 1) as log-bin-trust-routine-creators now affects only functions, the testing of this option, which was mainly done on procedures, is moved to functions 2) cleanup is simplified; and instead of many SHOW BINLOG EVENTS we do a big one in the end, which is more maintainable. 3) we test a few more function and procedures cases to see how they replicate. 4) removing out-of-date comments sql/item_func.cc: This warning is wrong since binlogging of functions was changed in August. If a function fails in the middle, it will be binlogged with its error code (i.e. properly). sql/mysql_priv.h: variable name changed sql/mysqld.cc: option name changes. A precision about --read-only. sql/set_var.cc: a new class sys_var_trust_routine_creators to be able to issue a "this is a deprecated variable" warning if used. sql/set_var.h: new class to be able to issue a "this is a deprecated variable" warning if used. sql/share/errmsg.txt: routine -> function sql/sp.cc: log-bin-trust-routine-creators now applies only to functions. sql/sql_parse.cc: 1) sending ER_FAILED_ROUTINE_BREAK_BINLOG is wrong since August as we don't binlog CALL anymore but instead binlog the substatements; the clear_error() goes away too as it was necessary only when we created a binlog event from the "CALL" statement. 2) log-bin-trust-routine-creators now applies only to functions. sql/sql_trigger.cc: comments.
Diffstat (limited to 'sql/sql_parse.cc')
-rw-r--r--sql/sql_parse.cc21
1 files changed, 8 insertions, 13 deletions
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 4bbca55f6ba..6677b8a09ad 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -4318,18 +4318,6 @@ end_with_restore_list:
So just execute the statement.
*/
res= sp->execute_procedure(thd, &lex->value_list);
- if (mysql_bin_log.is_open() &&
- (sp->m_chistics->daccess == SP_CONTAINS_SQL ||
- sp->m_chistics->daccess == SP_MODIFIES_SQL_DATA))
- {
- if (res)
- push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
- ER_FAILED_ROUTINE_BREAK_BINLOG,
- ER(ER_FAILED_ROUTINE_BREAK_BINLOG));
- else
- thd->clear_error();
- }
-
/*
If warnings have been cleared, we have to clear total_warn_count
too, otherwise the clients get confused.
@@ -4388,7 +4376,8 @@ end_with_restore_list:
if (end_active_trans(thd))
goto error;
memcpy(&lex->sp_chistics, &chistics, sizeof(lex->sp_chistics));
- if (!trust_routine_creators && mysql_bin_log.is_open() &&
+ if ((sp->m_type == TYPE_ENUM_FUNCTION) &&
+ !trust_function_creators && mysql_bin_log.is_open() &&
!sp->m_chistics->detistic &&
(chistics.daccess == SP_CONTAINS_SQL ||
chistics.daccess == SP_MODIFIES_SQL_DATA))
@@ -4399,6 +4388,12 @@ end_with_restore_list:
}
else
{
+ /*
+ Note that if you implement the capability of ALTER FUNCTION to
+ alter the body of the function, this command should be made to
+ follow the restrictions that log-bin-trust-function-creators=0
+ already puts on CREATE FUNCTION.
+ */
if (lex->sql_command == SQLCOM_ALTER_PROCEDURE)
result= sp_update_procedure(thd, lex->spname, &lex->sp_chistics);
else