What will mysql do with both INSERT IGNORE and … ON DUPLICATE KEY UPDATE ?
This is not a question about their differences. I ask because Talend ETL does this behind the UI and I’m worried it will have side effects especially if I don’t want to update and do something like this:
String insertIgnore_tMysqlOutput_10 = "INSERT IGNORE INTO `"
+ "Employees"
+ "` (`Name`,`JobTitle`) VALUES (?,?) ON DUPLICATE KEY UPDATE `Name` = ?";
IGNOREjust acts as a kind of error-suppressor, making fatal errors act as warnings instead.ON DUPLICATE KEY UPDATEdoesn’t trigger an error, soINGOREhas no effect on it.Therefore,
IGNOREhas no effect on duplicate keys whenON DUPLICATE KEY UPDATEis used as well. However, if a different error were to occur thenIGNOREwould indeed have an effect.