When I ran update after installing Location 7.x-3.0 this afternoon it called for the following update:
location module
7302 - Adds the Country code to name table "location_country". It is created from the included array country array.
However, when I ran that, I got the error message:
location module
Update #7302
Failed: DatabaseSchemaObjectExistsException: Table location_country already exists. in DatabaseSchema->createTable() (line 657 of /home/northbro/public_html/includes/database/schema.inc).
----
I'm running the site on Drupal 7.23.
Also updated Gmap module this afternoon, but it didn't require any database update.
---
Have not had time to determine performance impact, if any, of the update failure.
Thanks.
Bill
Comment | File | Size | Author |
---|---|---|---|
#42 | location-error_creating_table_update_7302-1054616-42.patch | 626 bytes | tinker |
Comments
Comment #1
Neograph734I ran into a similar issue, but that had a different cause. I went wrong on updating 'Bahama's'. The quote breaks the sql query and there is a half location_country table.
After running the update again I got the table already exists message. Did you run the update twice?
---
The fix is to alter the location.install file. Scroll all the way down and alter the line that performs the query. It's something like
query("$sql", "$sql2")
; Change it intoquery("$sql", addslashes($sql2))
UPDATE: You'll have to go into the database and remove the location_country table manually. Then run update again.
After that I ran into #2119967: [Needs steps to reproduce] Notice: Undefined offset: 1 in location_cck_tokens() (line 622 of location_cck.module). ...
Comment #2
mediameriquat CreditAttribution: mediameriquat commentedIt's definitely a quote problem. In my case, "Côte d'Ivoire" caused the failure. Here's the error message:
Failed: PDOException : SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Ivoire')' at line 1: INSERT INTO {location_country} (code, name) VALUES ('ci', 'Côte d'Ivoire'); Array ( ) in location_update_7302() (line 1328 in /path/modules/location/location.install).
I tried removing the location_country table manually, ran the update many times but it didn't work. The quick fix to the location.install module didn't work either (parse error).
Comment #3
Neograph734Oops, my bad. I've sent you the wrong line. Here is the whole function and this should work.
Comment #4
podarokgood to see here a patch in gir diff format http://drupal.org/patch
Comment #5
Neograph734I would not consider this a patch, more a quick fix. One could also use the quotes in different order:
I know too little of this module to provide a good solution.
Comment #6
kreatIL CreditAttribution: kreatIL commentedThe database update runs into this error:
"Fatal error: Call to undefined function location_get_iso3166_list() in (path)/sites/all/modules/location/location.install on line 1321"
Comment #7
bendev CreditAttribution: bendev commentedI tried #3 and #5 without succeess.
Do you need to do antyhing else than replace the function in location.install and rerun drush updb ?
Comment #8
helonaut CreditAttribution: helonaut commentedI've changed location.install and added the following line: $name = str_replace("'","\'",$name);
I deleted the table location_country manually before running this update again. Maybe this should be automated... Anyway this fix worked for me though.
Comment #9
podarokplease, upload patch in git diff format http://drupal.org/patch
Comment #10
helonaut CreditAttribution: helonaut commentedI'm sorry, first time using GIT.
I've attache a patch to this post... Could you verify if it's OK, please?
Comment #11
podarokbot
Comment #13
helonaut CreditAttribution: helonaut commentedI don't know why it failed, if I apply the patch it just works... I'm sorry, could someone help me with this patch-making and check what I did wrong please?
Comment #14
podarokYou should upload patch against latest 7.x-3.x-dev version for succesfull applying
Comment #15
jp.stacey CreditAttribution: jp.stacey commentedThe patch format looks fine and applies fine on a local checkout. The only thing I can think of that might be confusing the bot is the whitespaces in the filename.
Re-rolled and uploaded.
Comment #16
jp.stacey CreditAttribution: jp.stacey commentedSorry, now attached
Comment #17
Didier Misson CreditAttribution: Didier Misson commentedHello,
I apply the patch :
but update.php always give me an error :
Didier
Comment #18
kreatIL CreditAttribution: kreatIL commentedDidier: as Neograph734 stated in #1 above, you'll have to manually remove the location_country table in the database at first.
Comment #19
podaroktaggind
looks like we needs here hook_update workaround for #18
Comment #20
helonaut CreditAttribution: helonaut commentedThank you for your help @ #15 jp.stacey !
Comment #21
podarokBug was introduced here #380842: Views sort order incorrect for Country field
Comment #22
podarokhere is a fixed upgrade path with #16 injected and no more needed removal location_country table
Comment #23
podarok#22 commited pushed ti 7.x-3.x-dev
tagged 7.x-3.1 release
Thanks all for help!!!
Comment #25
tomb-2 CreditAttribution: tomb-2 commentedCan you confirm that the patch in #22 was committed correctly?
I'm not seeing it in the latest 7.x-3.x-dev.
Comment #26
yecarrillo CreditAttribution: yecarrillo commentedNeed to add
after function name to run properly. This is an issue with drupal 6 => 7 migration.
Comment #27
andrewfn CreditAttribution: andrewfn commentedThanks podarok!
It would have saved me a lot of time if this patch had been committed!
Comment #28
andrewfn CreditAttribution: andrewfn commentedComment #29
wildlife CreditAttribution: wildlife commentedI'm updating a site from Drupal 6 to Drupal 7. The location module upgrade is experiencing this failed database update. It is leaving the update as failed and now it is trying to run it every time I run the update script. It is failing each time.
When I run the update script, this is what appears:
location module
Update #7302
Failed: DatabaseSchemaObjectExistsException: Table location_country already exists. in DatabaseSchema->createTable() (line 657 of [path]/includes/database/schema.inc).
When I look in the Recent Log Messages, this is what appears:
DatabaseSchemaObjectExistsException: Table location_country already exists. in DatabaseSchema->createTable() (line 657 of [path]/includes/database/schema.inc).
I've tried installing the latest dev version of the module and it hasn't changed anything.
Please advise on how to get this database update completed so it isn't present and failing every time I run the update script.
Comment #30
Neograph734You'll have to delete the table manually first in order to attempt the update again, the patch that was supposed to fix that has not been pushed to the development build (I guess). Then apply the patch locally.
Comment #31
podarok22: 2119993-update-error-22.patch queued for re-testing.
Comment #33
wildlife CreditAttribution: wildlife commentedDeleting the table manually from the database worked. Thanks a bunch!
Comment #34
kerrycurtain CreditAttribution: kerrycurtain commentedDitto! Thanks.
Comment #37
tinker CreditAttribution: tinker commentedComment #2119993-23: Error creating table in update 7302 says patch from #2119993-22: Error creating table in update 7302 was committed but db_create_table() is still in 7.x-3.x-dev and 7.x-3.4. I have updated patch from #22 which does not need str_replace() on single quote since db_insert() handles it.
Comment #38
tinker CreditAttribution: tinker commentedRename to better describe the problem.
Comment #42
tinker CreditAttribution: tinker commentedLet's try that again with simple GIT patch.
Comment #43
podarokComment #44
podarokThanks #42 commited
Comment #47
tinker CreditAttribution: tinker commentedThx @podarok, One less thing to remeber when upgrading sites. Marked fixed again since code was commited and drupal bot got it wrong.