summaryrefslogtreecommitdiff
path: root/sql/sql_update.cc
diff options
context:
space:
mode:
authorunknown <davi@mysql.com/endora.local>2008-02-12 09:44:27 -0200
committerunknown <davi@mysql.com/endora.local>2008-02-12 09:44:27 -0200
commit8d51c6ad68e373551fd848204e1301481c051399 (patch)
tree52da33128696eb509708f62c43543ed1ed3d987b /sql/sql_update.cc
parenta0d88ebb0b5f77b30c65152f87aa73363ce93d71 (diff)
downloadmariadb-git-8d51c6ad68e373551fd848204e1301481c051399.tar.gz
Bug#23771 AFTER UPDATE trigger not invoked when there are no changes of the data
The problem is that AFTER UPDATE triggers will fire only if the new data is different from the old data on the row. The trigger should fire regardless of whether there are changes to the data. The solution is to fire the trigger on UPDATE even if there are no changes to the value (because the value is the same). mysql-test/r/trigger.result: Add test case result for Bug#23771 mysql-test/t/trigger.test: Add test case for Bug#23771 sql/sql_update.cc: Move the invocation of the after update trigger so that the trigger will fire even if the records are the same.
Diffstat (limited to 'sql/sql_update.cc')
-rw-r--r--sql/sql_update.cc34
1 files changed, 17 insertions, 17 deletions
diff --git a/sql/sql_update.cc b/sql/sql_update.cc
index 4d075e3308d..d895d2ee0f2 100644
--- a/sql/sql_update.cc
+++ b/sql/sql_update.cc
@@ -643,14 +643,6 @@ int mysql_update(THD *thd,
updated++;
else
error= 0;
-
- if (table->triggers &&
- table->triggers->process_triggers(thd, TRG_EVENT_UPDATE,
- TRG_ACTION_AFTER, TRUE))
- {
- error= 1;
- break;
- }
}
else if (!ignore ||
table->file->is_fatal_error(error, HA_CHECK_DUP_KEY))
@@ -669,6 +661,14 @@ int mysql_update(THD *thd,
}
}
+ if (table->triggers &&
+ table->triggers->process_triggers(thd, TRG_EVENT_UPDATE,
+ TRG_ACTION_AFTER, TRUE))
+ {
+ error= 1;
+ break;
+ }
+
if (!--limit && using_limit)
{
/*
@@ -1644,12 +1644,12 @@ bool multi_update::send_data(List<Item> &not_used_values)
trans_safe= 0;
thd->transaction.stmt.modified_non_trans_table= TRUE;
}
- if (table->triggers &&
- table->triggers->process_triggers(thd, TRG_EVENT_UPDATE,
- TRG_ACTION_AFTER, TRUE))
- DBUG_RETURN(1);
}
}
+ if (table->triggers &&
+ table->triggers->process_triggers(thd, TRG_EVENT_UPDATE,
+ TRG_ACTION_AFTER, TRUE))
+ DBUG_RETURN(1);
}
else
{
@@ -1881,12 +1881,12 @@ int multi_update::do_updates()
updated++;
else
local_error= 0;
-
- if (table->triggers &&
- table->triggers->process_triggers(thd, TRG_EVENT_UPDATE,
- TRG_ACTION_AFTER, TRUE))
- goto err2;
}
+
+ if (table->triggers &&
+ table->triggers->process_triggers(thd, TRG_EVENT_UPDATE,
+ TRG_ACTION_AFTER, TRUE))
+ goto err2;
}
if (updated != org_updated)