summaryrefslogtreecommitdiff
path: root/sql/sql_parse.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/sql_parse.cc')
-rw-r--r--sql/sql_parse.cc25
1 files changed, 25 insertions, 0 deletions
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index b0b7afc6528..7226a8e3c86 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -33,6 +33,7 @@
#include "sp_head.h"
#include "sp.h"
#include "sp_cache.h"
+#include "sql_trigger.h"
#ifdef HAVE_OPENSSL
/*
@@ -2485,6 +2486,30 @@ mysql_execute_command(THD *thd)
#ifdef HAVE_REPLICATION
if (unlikely(thd->slave_thread))
{
+ if (lex->sql_command == SQLCOM_DROP_TRIGGER)
+ {
+ /*
+ When dropping a trigger, we need to load its table name
+ before checking slave filter rules.
+ */
+ add_table_for_trigger(thd, thd->lex->spname, 1, &all_tables);
+
+ if (!all_tables)
+ {
+ /*
+ If table name cannot be loaded,
+ it means the trigger does not exists possibly because
+ CREATE TRIGGER was previously skipped for this trigger
+ according to slave filtering rules.
+ Returning success without producing any errors in this case.
+ */
+ DBUG_RETURN(0);
+ }
+
+ // force searching in slave.cc:tables_ok()
+ all_tables->updating= 1;
+ }
+
/*
Check if statment should be skipped because of slave filtering
rules