CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Upgrading CiviCRM (Moderator: Deepak Srivastava) »
  • Database error on upgrade to 2.2.0 from 2.1.1 -- would be nice to update install
Pages: [1]

Author Topic: Database error on upgrade to 2.2.0 from 2.1.1 -- would be nice to update install  (Read 1098 times)

randallemery

  • Guest
Database error on upgrade to 2.2.0 from 2.1.1 -- would be nice to update install
March 21, 2009, 06:23:51 pm
I received the following error when upgrading:

Code: [Select]
unrecoverable error
    Sorry. A non-recoverable error has occurred.

    DB Error: already exists

    Database Error Code: Duplicate entry '751-6' for key 2, 1062

    Return to home page.

Error 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 UI_contact_id_tag_id ( contact_id, tag_id ) [nativecode=1062 ** Duplicate entry '751-6' for key 2]
    [type] => DB_Error
    [user_info] => ALTER TABLE civicrm_entity_tag
  ADD UNIQUE UI_contact_id_tag_id ( contact_id, tag_id ) [nativecode=1062 ** Duplicate entry '751-6' 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 UI_contact_id_tag_id ( contact_id, tag_id ) [nativecode=1062 ** Duplicate entry '751-6' for key 2]"]
)

To solve the problem:

1) manually deleted tables in the CiviCRM database
2) restored both the CiviCRM 2.1.1 code and database, and verified everything worked
3) went into phpMyAdmin and executed the following SQL statement to identify duplicates in the civicrm_entity_tag table:
Code: [Select]
SELECT * , count( contact_id ) AS counter
FROM `civicrm_entity_tag`
GROUP BY `contact_id` , tag_id
ORDER BY `counter` DESC
4) still in phpMyAdmin, manually deleted duplicates identified in step above
5) backed up new version of CiviCRM database
6) am repeating upgrade process now

Just documenting here for anybody else who might experience the same problem.  Also, it would be nice to upgrade the install file to do this automatically.[/code]

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Database error on upgrade to 2.2.0 from 2.1.1 -- would be nice to update install
March 21, 2009, 06:40:27 pm

we detected this error a few days ago and have fixed it in the svn repository

it will be part of 2.2.1

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

sraisz

  • I post occasionally
  • **
  • Posts: 52
  • Karma: 0
    • sambandha.net
  • CiviCRM version: 3.3.5
  • CMS version: Drupal 6
Re: Database error on upgrade to 2.2.0 from 2.1.1 -- would be nice to update install
December 21, 2011, 12:27:34 am
I have the same problem updating from 2.1 to 2.2.

I tried using 2.2.1 for update but still getting problem with duplicates in the civicrm_entity_tag table. THere are at least 200 dupes so manually identifying and deleting will be very time consuming.

Any suggestions?

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Upgrading CiviCRM (Moderator: Deepak Srivastava) »
  • Database error on upgrade to 2.2.0 from 2.1.1 -- would be nice to update install

This forum was archived on 2017-11-26.