Details
-
Type: Bug
-
Status: Done/Fixed
-
Priority: Trivial
-
Resolution: Cannot Reproduce
-
Affects Version/s: 3.4.5
-
Fix Version/s: None
-
Component/s: None
-
Labels:None
Description
When I ran the upgrade script, I got the following SQL error:
Database Error Code: Duplicate entry 'civicrm_contact-2539-14' for key 2, 1062
Additional Details:
Array
(
[callback] => Array
(
[0] => CRM_Core_Error
[1] => handle
)
[code] => -5
[message] => DB Error: already exists
[mode] => 16
[debug_info] => ALTER TABLE civicrm_entity_tag
ADD UNIQUE INDEX UI_entity_id_entity_table_tag_id( entity_table, entity_id, tag_id ) [nativecode=1062 ** Duplicate entry 'civicrm_contact-2539-14' for key 2]
[type] => DB_Error
[user_info] => ALTER TABLE civicrm_entity_tag
ADD UNIQUE INDEX UI_entity_id_entity_table_tag_id( entity_table, entity_id, tag_id ) [nativecode=1062 ** Duplicate entry 'civicrm_contact-2539-14' for key 2]
[to_string] => [db_error: message="DB Error: already exists" code=-5 mode=callback callback=CRM_Core_Error::handle prefix="" info="ALTER TABLE civicrm_entity_tag
ADD UNIQUE INDEX UI_entity_id_entity_table_tag_id( entity_table, entity_id, tag_id ) [nativecode=1062 ** Duplicate entry 'civicrm_contact-2539-14' for key 2]"]
)
I did some looking around, and noticed that that many records in the database had a single tag had been applied several times against the same contact. I manually removed the duplicates from the table "civicrm_entity_tag" using PhpMyAdmin, then the upgrade script works.