I did not find a function to get the columnname and value involved and I don't like to parse strings which can change some day. Any ideas? (maybe I was to blind to find anything on the www)
One way is to use ON DUPLICATE KEY UPDATE and populate a different column with the failed update field. The better option is to use a stored procedure to do the insert and use a DECLARE HANDLER to return the duplicate fields.