Commit c052bec0 authored by Bharathy Satish's avatar Bharathy Satish

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.
parent 8e9bb710
...@@ -458,6 +458,13 @@ bool mysql_create_or_drop_trigger(THD *thd, TABLE_LIST *tables, bool create) ...@@ -458,6 +458,13 @@ bool mysql_create_or_drop_trigger(THD *thd, TABLE_LIST *tables, bool create)
*/ */
thd->lex->sql_command= backup.sql_command; 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)) if (add_table_for_trigger(thd, thd->lex->spname, if_exists, & tables))
goto end; goto end;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment