I have an issue where whenever I add an AFTER INSERT trigger to a specific table in a mySQL database, the transaction that trips the trigger will fail due to "Duplicate entry '0' for key 'assetevent.PRIMARY'".
If I remove the trigger, it works just fine.
The trigger in question updates the table, but does not cause another INSERT to occur.
UPDATE `schemaA`.`assetevent`
SET `EndDate` = RecentStart
WHERE `indexEvent` = RecentEnd;
The trigger is used to update the previous entry's end date with the start date of the current entry being written.
The primary key of the table is indexEvent, and is set up as PK, NN, UQ, and AI. Any idea why I would be getting this error?