When I run update.php I am getting following error. Please help me. Am I missing something.

The following updates returned messages
geocoder module
Update #7101
Failed: DatabaseSchemaObjectExistsException: Table cache_geocoder already exists. in DatabaseSchema->createTable() (line 660 of G:\Acquia_Sites\Dev_Desktop\uwcx-ra\docroot\includes\database\schema.inc).

CommentFileSizeAuthor
#6 2866059-avoid-table-conflicts.patch660 bytesgreggles

Comments

mhentry created an issue. See original summary.

gmaximus’s picture

I've just run into the same bug when updating a website. Any further development or information on this?

guillaumeduveau’s picture

In Drupal 7, hook_schema() automatically installs the DB table(s), so adding an update to install the schema produces this error. The whole geocoder_update_7101() should be deleted. Either you patch the module, either you modify the schema_version in your DB:

UPDATE system SET schema_version=7101 WHERE name='geocoder' and schema_version=7100;

pol’s picture

Status: Active » Closed (won't fix)
greggles’s picture

Title: Error while running update.php » Error while running database update: geocoder_update_7101 causes Table cache_geocoder already exists error.
Category: Support request » Bug report
Status: Closed (won't fix) » Active

I'm running into this issue as well and it seems like a bug to me, so reopening and recategorizing for feedback on that.

My scenario is that I've been running geocoder 7.x-1.2 for a while. I just upgraded to geocoder 7.x-1.3 and am getting the error when running "drush updb:"

Table cache_geocoder already exists.                                                                                                       [error]

As far as I know it's not generally right to manually call drupal_install_schema('geocoder'); from inside of a hook update. I don't know why it's not working in this specific instance. However, if that seems like the thing you really want to do, it could at least be wrapped in a db_table exists, e.g.

  if (!db_table_exists('cache_geocoder')) {
    drupal_install_schema('geocoder');
  }

What do you think would be the right way to solve this?

greggles’s picture

Status: Active » Needs review
StatusFileSize
new660 bytes

Here's a patch that minimally addresses both of the issues I mentioned.

amazingrando’s picture

I applied the patch in #6 and all is well. Thank you!

johnhanley’s picture

+1 for #6 patch.

  • poker10 committed a298fe2c on 7.x-1.x authored by greggles
    Issue #2866059 by greggles: Error while running database update:...
poker10’s picture

Status: Needs review » Fixed

Yes, it is not good to run drupal_install_schema() inside an update hook. The patch #6 looks good, though not sure how many sites it will help after so many years. But better to have it right, so I have committed this. Thanks all!

Status: Fixed » Closed (fixed)

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