Bug #87412 | The behaviour of the triggers after "INSERT ... ON DUPLICATE KEY UPDATE" | ||
---|---|---|---|
Submitted: | 14 Aug 2017 13:25 | Modified: | 24 Oct 2018 18:34 |
Reporter: | SINISA MILIVOJEVIC | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server: Documentation | Severity: | S3 (Non-critical) |
Version: | 5.6, 5.7 | OS: | Any |
Assigned to: | CPU Architecture: | Any |
[14 Aug 2017 13:25]
SINISA MILIVOJEVIC
[24 Oct 2018 18:34]
Paul DuBois
Posted by developer: The underlying bug (Bug#87371) has been fixed, so there's no longer an exceptional behavior to document for that. Regarding behavior of ON DUPLICATE KEY UPDATE and triggers, that is already documented at https://dev.mysql.com/doc/refman/8.0/en/create-trigger.html: The trigger_event does not represent a literal type of SQL statement that activates the trigger so much as it represents a type of table operation. For example, an INSERT trigger activates not only for INSERT statements but also LOAD DATA statements because both statements insert rows into a table. A potentially confusing example of this is the INSERT INTO ... ON DUPLICATE KEY UPDATE ... syntax: a BEFORE INSERT trigger activates for every row, followed by either an AFTER INSERT trigger or both the BEFORE UPDATE and AFTER UPDATE triggers, depending on whether there was a duplicate key for the row.