I'm attempting a long-overdue upgrade from 7.x-3.x to 7.x-4.x, and got hung up on webform_update_7419 with this error:

Cannot add index data to table webform_submitted_data: index already exists.

So I've added a db_index_exists() check to that update hook so it won't halt when this happens.

CommentFileSizeAuthor
upgrade_3_to_4_index_fix.patch483 byteschellman
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

DanChadwick’s picture

Category: Bug report » Support request
Status: Needs review » Fixed

The better question would be why did your webform have an index on that column? Webform didn't put it there (to my knowledge). Perhaps you added it yourself? Or some other module adjusted webform's tables?

I don't think it's appropriate to check every database schema operation to see if someone has already done it.

Now if you can figure out that webform actually created the index twice, that's different!

DanChadwick’s picture

Category: Support request » Feature request
Status: Fixed » Active

Oooh. Another thought. Did PHP timeout on building the index and you repeated the update? If so, then it might be possible for the table to have the index but the schema number in the system table to not have been updated. In that case, your patch would be a good idea.

  • DanChadwick committed cf9d5a5 on 7.x-4.x
    Issue #2455937 by chellman: Upgrade from 7.x-3.x fails on update 7419 -...
DanChadwick’s picture

Category: Feature request » Bug report
Status: Active » Fixed

Based on #2 and comparing it to other hook_update's that add an index, I think this is a good patch. Thank you.

Committed to 7.x-4.x

ecvandenberg’s picture

Just to get things clear to me...

I got the same error during performing database updates after update from Webform 7.x-3.23 to Webform 7.x-4.5. I certainly did not put that index there myself. And I don't have any Webform related projects installed. Perhaps Content Access 7.x-1.2-beta2 does something? If you need a full list of installed projects just let me know.

Can I just ignore the error and continue to work with the updated Webform module?

For now I restored my backup.

DanChadwick’s picture

Re #5: This patch was committed to 7.x-4.x after 7.x-4.4 was released. So you can:

  1. Manually comment out the line of code in webform_update_7417() that creates the index and update with 7.x-4.5.
  2. Update with the latest dev.
  3. Wait for 7.x-4.6.
chellman’s picture

I also thought it was weird that this happened - it was on a development copy of the site in question, and when I ran the db update on the live version, it didn't get hung up. I didn't notice any timeouts or other weirdness, just the update failing. But anyway, I'm glad this seems to be helpful even if the problem is rare.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.