DB Error: constraint violation
Strange, we had an issue on 4.6.24 just now.

The CiviCRM log file stated: -

DB Error: constraint violation


The debug information should give you the MySQL table name. For some reason, a custom table (civicrm_value_tablename_id) was linked by foreign key (entity_id) to the wrong table. In my case, it was the civicrm_event table, whereas it should have been to the civicrm_participant table.

My solution was to truncate (empty) the civicrm_value_tablename_id table, remove the incorrect foreign key, then add the correct foreign key.

Strange though that I had to do this manually as the CiviCRM custom data set screen showed that the Custom Data set in question is 'Used for' (or extends Participants).