update 5.7 to 6.0 failed "ALTER TABLE {locales_target} ADD PRIMARY KEY (language, lid, plural)"
int - February 18, 2008 - 00:47
| Project: | Drupal |
| Version: | 6.x-dev |
| Component: | locale.module |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | needs review |
Description
When I update 5.7 to 6.0 show only this error:
user warning: Duplicate entry '0-0' for key 1 query: ALTER TABLE drupal_locales_target ADD PRIMARY KEY (language, lid, plural) in C:\Program Files\VertrigoServ\www\includes\database.mysql-common.inc on line 374.
Failed: ALTER TABLE {locales_target} ADD PRIMARY KEY (language, lid, plural)
In the BD I see that in drupal_locales_target I have almost 55 rows with lid = 0.
| Attachment | Size |
|---|---|
| upgrade.jpg | 73.59 KB |

#1
I see that this problem is from 5.7.
How to fix this? Just delete lid=0? Or is better to delete pt language and add again..
#2
#3
I have the same problem, how is this fixed?
#4
delete all lid=0 in {locales_target}. and make the alter manual.
#5
Hi.
I too have this issue. Yet, my {locales_target} has no records.
Any thoughts on what I could do to resolve?
Thanks!
#6
how does one do this manually? I tried putting ALTER TABLE {locales_target} ADD PRIMARY KEY (language, lid, plural) in the SQL window, and I get a 1064 syntax error. I tried to make the lid column the primary key - which helped me find all the duplicates so I could delete them. However, making language or plural the primary key will drop lid from being the primary key. Any advice on what I'm doing wrong & what I need to do?
#7
ryooki - change the {} with the real name of the tables.
#8
I've the same problem, but my error is
user warning: Duplicate entry '636-0' for key 1 query: ALTER TABLE locales_target ADD PRIMARY KEY (language, lid, plural) in /Applications/MAMP/htdocs/walterfantauzzi/includes/database.mysql-common.inc on line 374.
How I can do?
#9
I get the same error, upgrading from 5.18 :
user warning: Duplicate entry '482-0' for key 1 query: ALTER TABLE locales_target ADD PRIMARY KEY (language, lid, plural) in /includes/database.mysql-common.inc on line 374.Now, the odd part is that if I execute this SQL statement in PHPMyAdmin right after the update.php has finished to run for the first time (during the upgrade procedure), it works, without any error and the primary key is set as those three fields. So I have no idea why it fails when it is used in update.php.
#10
I know it's confusing, but "update.module" is for the part of core (added in 6.x) that checks for available updates to your modules and themes. You're talking about update.php, which is the "update system" component...
However, more specifically, this is a problem with the locale module's DB updates, so that'd be an even more appropriate place to get help...
#11
#345852: update_6043: Duplicate entry warning when adding primary key to locales_target and #237715: D5 upgrade: ALTER TABLE locales_target fails has been marked as duplicate by catch. This is a bug so marking as this.
#12
I'm getting this as well.
Marked #345852: update_6043: Duplicate entry warning when adding primary key to locales_target and #237715: D5 upgrade: ALTER TABLE locales_target fails as duplicate.
Patch uses ALTER IGNORE TABLE - which will delete the duplicate records while making the new index.
ALTER IGNORE is MySQL specific - however I'm not sure if postgres will just ignore the keyword (in which case no worse off than now), or throw a syntax error - but this needs to be checked before commit.
#13
Added check for pgsql, which falls back to current behaviour.