Running update.php on 7.x-1.1+65-dev from 7.x-1.0 fails at update #7004 with:

field_group module

Update #7004
Failed: PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'group_attachments|node|page|form' for key 'identifier': ALTER TABLE {field_group} ADD UNIQUE KEY `identifier` (`identifier`); Array ( ) in db_add_unique_key() (line 2886 of /var/www/cmog/drupal/includes/database/database.inc).

Comments

alanburke’s picture

Run update 7003 again - did the trick for me

drupal a11y’s picture

Get the same issue:

field_group module
    7004 - Update hook to make sure identifier is set as unique key.
    7005 - Checks all existing groups and removes optional HTML classes while adding them as extra classes.

result:

Update #7004
    Failed: PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'group_colright|node|artist|default' for key 'identifier': ALTER TABLE {field_group} ADD UNIQUE KEY `identifier` (`identifier`); Array ( ) in db_add_unique_key() (line 2915 of /Applications/MAMP/htdocs/100_Projects/thezooproject/includes/database/database.inc).

How do I run the Update #7003 again?

Patribus’s picture

How can one carry out earlier updates?

I'm stucked with the

7004 - Update hook to make sure identifier is set as unique key.
 7005 - Checks all existing groups and removes optional HTML classes while adding them as extra classes.

updates, since after installing the module, no tables were created in my DB (see here)

MAybe, if I install an earlier version, this would work, no?

I really do not know how to create the missing module tables...

CHeers

Patribus’s picture

well, here a comment about my problem http://drupal.org/node/1966064#comment-7417968, it apparently does not have anything to do with the module itself but with some problems in ma drupal installation.
Cheers

gnite’s picture

I have had the same issue and I found that I had in the field_group table entries with an empty identifier, must have been from before upgrading D6>D7 or something. Obviously, since this update is trying to make the identifier column a unique index, there can't be multiple entries with the same (empty) value. Deleting them solved the issue.

nils.destoop’s picture

If you really have a duplicate record group_attachments|node|page|form. Then this should be fixed in the database. One of the records should be removed manually in the database. Running 7003 again won't help with that issue.

brian_c’s picture

I had this error when attempting to upgrade field_group from 1.0-rc2 to 1.2... the identifier field was completely empty, leading to an error when trying to add it as a unique index. This had the effect of killing all my field groups.

Upgrading in two steps, first from 1.0-rc2 to 1.0, and then from 1.0 to 1.2, fixed the issue.

Input’s picture

Had the same error/warning when updating to 7.x-1.2

Looked into field_groups table an renamed all duplicate groups (name and identifier part) and then deleted them within content type setup.

I think this happend because i used a dev version a while ago. At least the IDs of the duplicate group entries where far apart newer groups. So i think it was because of an version-change or because i deleted these groups earlier and recreated them a while ago with same names

Since the name or id wasn't used anywhere else renaming worked and you look inside contet-structure which group is still beeing used. The others just appear on the bottom of the list and can be deleted.

Maybe a solution is to programmatically check and rename duplicate groupnames during update procedure and give a warning that you should look into your content-types for groups with no children?

nils.destoop’s picture

Did all of you did the D6 > D7 upgrade? Seems like there was an issue in it, that can cause duplicate records: #1804840: Duplicate Group Names Cause D6->D7 Problem

markie’s picture

I ran into this issue and it seems that my field group was being duplicated in my display. Both were named group_meta. I created a second group (in my fields), and named it group_meta2. Moved the fields into the new group and then deleted the old group. The group in my display was still present, and so I deleted group_meta out of my fields listing. Then I was able to run the updates.

mbqt’s picture

I also met the same problem,
Field Group Update on 7.x-1.1 to 7.x-1.2 And 7.x-1.1 to 7.x-1.3
Running update.php Error:

Reminder: don't forget to set the $update_free_access value in your settings.php file back to FALSE.

    Front page

The following updates returned messages
field_group module
Update #7004

    Failed: PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'group_cptd|node|products|default' for key 'identifier': ALTER TABLE {field_group} ADD UNIQUE KEY `identifier` (`identifier`); Array ( ) 在 db_add_unique_key() (行 2915 在 /data/www/html/includes/database/database.inc).

technotronic12’s picture

Issue summary: View changes

Have same error on update from 1.1 to 1.3. Anyone found cause or solution?

Update #7004
Failed: PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'group_contact|node|site|form' for key 'identifier': ALTER TABLE {field_group} ADD UNIQUE KEY `identifier` (`identifier`); Array ( ) in db_add_unique_key() (line 2915 of E:\xampp\htdocs\hapisga\includes\database\database.inc

Iv'e managed to see the duplicate values for identifier field by running this query:

SELECT * FROM `field_group` WHERE identifier in (Select identifier from `field_group` group by identifier having count(*) > 1 order by identifier)

Deleting the duplicate records didn't work, had to go back to older module version and recover the database.

bdimaggio’s picture

Hey all -- alanburke's solution worked for me too. (Thanks alanburke!) Here's a quick and dirty way to do it:
1. Download/install devel module.
2. Go to the newly available /devel/php
3. In the resulting textarea, php-include the install file for Field Group, then manually call field_group_update_7003(). I.e.:

include(drupal_get_path('module', 'field_group') . '/field_group.install');
field_group_update_7003();

4. Run the code there, then go back and run the database install process again. Should work this time!

Sutharsan’s picture

Another dirty way to re-run the '7003' update script:

  • Execute the following mysql query, for example using PhpMyAdmin: update system set schema_version = '7002' where name = 'field_group';
  • Start the update process as usual.
boyan.borisov’s picture

Status: Active » Needs review

I submitted patch here which should handle these cases, too

nils.destoop’s picture

Status: Needs review » Closed (duplicate)

Tat patch should idd fix this. Marking as duplicate.