summaryrefslogtreecommitdiff
path: root/sql/sql_trigger.cc
diff options
context:
space:
mode:
authorBharathy Satish <bharathy.x.satish@oracle.com>2014-01-07 15:11:05 +0530
committerBharathy Satish <bharathy.x.satish@oracle.com>2014-01-07 15:11:05 +0530
commitc1fa843d65f8d8173378136abd638198e05b43b1 (patch)
treee1ebe91910fb55f70aed9485e80c6b9be9d16953 /sql/sql_trigger.cc
parent160dd24253473224e40778a291e70f481ace028c (diff)
downloadmariadb-git-c1fa843d65f8d8173378136abd638198e05b43b1.tar.gz
Bug #17503460 MYSQL READ ONLY DOESN'T WORK FOR DROP TRIGGER
Problem: Drop Trigger succeeds even after setting read_only variable to ON. Fix: Fix is to report the standard error (ER_OPTION_PREVENTS_STATEMENT)when global read_only variable is set to ON.
Diffstat (limited to 'sql/sql_trigger.cc')
-rw-r--r--sql/sql_trigger.cc7
1 files changed, 7 insertions, 0 deletions
diff --git a/sql/sql_trigger.cc b/sql/sql_trigger.cc
index 5cdb38ed157..0a4f549a052 100644
--- a/sql/sql_trigger.cc
+++ b/sql/sql_trigger.cc
@@ -458,6 +458,13 @@ bool mysql_create_or_drop_trigger(THD *thd, TABLE_LIST *tables, bool create)
*/
thd->lex->sql_command= backup.sql_command;
+ if (opt_readonly && !(thd->security_ctx->master_access & SUPER_ACL) &&
+ !thd->slave_thread)
+ {
+ my_error(ER_OPTION_PREVENTS_STATEMENT, MYF(0), "--read-only");
+ goto end;
+ }
+
if (add_table_for_trigger(thd, thd->lex->spname, if_exists, & tables))
goto end;