There is a discovery based action, that removes registered hosts.
I the host has a trigger, that was created by item discovery, the removal fails with:
The code tries to delete the triggers "triggerid between 22917 and 22921". As there is trigger_discovery table with foreign key to triggers table, the lookup of dependent records is being performed and "or triggerid in (22934,22935,22936)" clause is added.
But it seems, that mysql does not understand that the resulting combination will remove all the necessary triggers.
If the added clause is executed seperately, the the original statement succeeds:
Also if the parent triggerid is already in the original list, no clause is added, thus requiring a manual query to determine the failing triggerid: