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.

AttachmentSize
upgrade.jpg73.59 KB

#1

int - February 18, 2008 - 00:58
Category:bug report» support request

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

int - February 18, 2008 - 01:09
Status:active» closed

#3

liquid crystal - February 18, 2008 - 19:38

I have the same problem, how is this fixed?

#4

int - February 19, 2008 - 01:16

delete all lid=0 in {locales_target}. and make the alter manual.

#5

tcconway - June 17, 2008 - 21:14

Hi.
I too have this issue. Yet, my {locales_target} has no records.
Any thoughts on what I could do to resolve?
Thanks!

#6

ryooki - July 27, 2008 - 17:05

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

int - July 29, 2008 - 22:19

ryooki - change the {} with the real name of the tables.

#8

ryosaeba - March 8, 2009 - 11:48

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

TheRec - June 15, 2009 - 14:14
Version:6.0» 6.12
Status:closed» active

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

dww - June 16, 2009 - 03:48
Component:update.module» locale.module

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

hass - September 25, 2009 - 18:11
Category:support request» bug report

#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

catch - September 26, 2009 - 04:32
Version:6.12» 6.x-dev
Status:active» needs review

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.

AttachmentSize
locales_target.patch 822 bytes

#13

catch - October 27, 2009 - 05:36

Added check for pgsql, which falls back to current behaviour.

AttachmentSize
locales-target.patch 1.31 KB
 
 

Drupal is a registered trademark of Dries Buytaert.