OJS OCS OMP OHS

You are viewing the PKP Support Forum | PKP Home Wiki



DB: duplicate key entry '23' for key 'PRIMARY'

Are you responsible for making OJS work -- installing, upgrading, migrating or troubleshooting? Do you think you've found a bug? Post in this forum.

Moderators: jmacgreg, btbell, michael, bdgregg, barbarah, asmecher

Forum rules
What to do if you have a technical problem with OJS:

1. Search the forum. You can do this from the Advanced Search Page or from our Google Custom Search, which will search the entire PKP site. If you are encountering an error, we especially recommend searching the forum for said error.

2. Check the FAQ to see if your question or error has already been resolved.

3. Post a question, but please, only after trying the above two solutions. If it's a workflow or usability question you should probably post to the OJS Editorial Support and Discussion subforum; if you have a development question, try the OJS Development subforum.

DB: duplicate key entry '23' for key 'PRIMARY'

Postby btbell » Tue Nov 06, 2012 1:32 pm

All,

I am upgrading a couple of instances of OJS, one is going from 2.2.3.5 -> 2.2.3.8, another is going from 2.2.3.6 -> 2.2.3.8. Both upgrades are failing while running the upgrade.php script. The error is the same on both instances, "DB: duplicate key entry '23' for key 'PRIMARY'. Each instance is on a different physical server, different database. I have tried clearing the session cache via the admin panel but to no avail. I have seen similar errors posted here but no clear resolutions. Any direction would be appreciated.

Thanks!

-brian

### UPDATE ###
I started from scratch with this upgrade and this time got the following error: DB error: Duplicate entry '2-244' for key 'u_e_pkey'</h1>ojs2: DB Error: Duplicate entry '2-244' for key 'u_e_pkey'

Image
btbell
 
Posts: 16
Joined: Tue Nov 06, 2012 1:19 pm

Re: DB: duplicate key entry '23' for key 'PRIMARY'

Postby jmacgreg » Thu Nov 15, 2012 1:05 am

Hi Brian,

I'm running into the original problem, currently happening while running the [data: registry/citationAssistantData.xml] step. I'm curious as to why this may not be happening with you -- have you changed anything file- or db-wise between upgrade attempts? And are these upgrades via the download file online, or via a git pull?

Cheers,
James
jmacgreg
 
Posts: 4190
Joined: Tue Feb 14, 2006 10:50 am

Re: DB: duplicate key entry '23' for key 'PRIMARY'

Postby btbell » Thu Nov 15, 2012 7:36 am

Hi James,

We haven't made any modifications to the build. In fact, we've successfully upgraded about 25 instances with no issues. We're still trying to figure out why 4-5 instances are giving us this problem. The code is the release package from PKP, not the Git repos.

Hope this helps. Give me a shout if you have any additional questions.

-b

Brian T. Bell ∷ Web Developer ∷ University Library System ∷ University of Pittsburgh ∷ http://www.library.pitt.edu
btbell
 
Posts: 16
Joined: Tue Nov 06, 2012 1:19 pm

Re: DB: duplicate key entry '23' for key 'PRIMARY'

Postby raickonen » Wed Mar 20, 2013 4:14 am

We had this same problem while testing the upgrade from 2.3.5(package downloaded with all recomended patches applyed) to the 2.3.8 we got the error below(We did not modified the original database):

Code: Select all
[data: dbscripts/xml/upgrade/2.3.7_update.xml]
[data: registry/citationAssistantData.xml]
ERROR: Upgrade failed: DB: Duplicate entry '23' for key 1


Any ideas?

Luciano
raickonen
 
Posts: 34
Joined: Tue Nov 16, 2010 10:39 am

Re: DB: duplicate key entry '23' for key 'PRIMARY'

Postby asmecher » Wed Mar 20, 2013 6:45 am

Hi Luciano,

I would suggest removing the following line from dbscripts/xml/upgrade.xml and following the upgrade instructions again:
Code: Select all
<data file="registry/citationAssistantData.xml" />
Note that you should probably restore your pre-upgrade database from backup, as after an upgrade failure, your database will be in an inconsistent state.

Regards,
Alec Smecher
Public Knowledge Project Team
asmecher
 
Posts: 9201
Joined: Wed Aug 10, 2005 12:56 pm

Re: DB: duplicate key entry '23' for key 'PRIMARY'

Postby gustavotonini » Wed Mar 20, 2013 9:48 am

I've got the same problem upgrading from 2.3.6 to 2.3.8

Is removing "registry/citationAssistantData.xml" the oficial fix procedure? Can it affect next upgrades?
gustavotonini
 
Posts: 26
Joined: Wed Mar 20, 2013 9:44 am

Re: DB: duplicate key entry '23' for key 'PRIMARY'

Postby asmecher » Wed Mar 20, 2013 10:10 am

Hi gustavotonini,

That line has already been removed from later releases e.g. for upgrading to 2.4.2; if you're encountering duplicates, it's because the data it tries to add is already in place. This won't affect future upgrades.

Regards,
Alec Smecher
Public Knowledge Project Team
asmecher
 
Posts: 9201
Joined: Wed Aug 10, 2005 12:56 pm

Re: DB: duplicate key entry '23' for key 'PRIMARY'

Postby raickonen » Wed Mar 20, 2013 12:08 pm

Alec,

Worked!

Thanks, keep up the good job!

Regards,

Luciano
raickonen
 
Posts: 34
Joined: Tue Nov 16, 2010 10:39 am

Re: DB: duplicate key entry '23' for key 'PRIMARY'

Postby paul » Thu Apr 11, 2013 9:36 pm

I am upgrading from 2.3.3 to 2.4.2. I got this error message when upgrading the database:

DB Error: Duplicate entry '6271-15322' for key 'u_e_pkey'

I am using web/Full Package method. System: PHP Version 5.2.17 on Linux box710 at bluehost.com.

I tried searching u_e_pkey on the database to determine which tables are affected but found nothing.

Please help.

Thanks.

Paul
paul
 
Posts: 97
Joined: Thu Dec 06, 2007 9:58 pm

Re: DB: duplicate key entry '23' for key 'PRIMARY'

Postby paul » Fri Apr 12, 2013 9:30 am

I used the patch method to upgrade. It worked to some degree.

1. Place 2.3.3_to_2.4.2.patch in ojs directory
2. php tools/upgrade.php patch
3. php tools/upgrade.php upgrade

I got "Successfully upgraded to 2.3.6" but not 2.4.2.

I also noticed after running php tools/upgrade.php patch, I saw this:

Code version: 2.3.6
Database version: 2.3.3
Latest version: 2.4.2

Database version is older than code version.

Run "tools/upgrade.php upgrade" to upgrade

What went wrong?

Thanks.

Paul
paul
 
Posts: 97
Joined: Thu Dec 06, 2007 9:58 pm

Re: DB: duplicate key entry '23' for key 'PRIMARY'

Postby asmecher » Fri Apr 12, 2013 10:12 am

Hi Paul,

If you saw "Successfully upgraded to 2.3.6", then the OJS 2.4.2 patch was not applied. Is it possible that a previous upgrade failed and left you with a mix of versions? Do you have the full output of the upgrade procedure?

Regards,
Alec Smecher
Public Knowledge Project Team
asmecher
 
Posts: 9201
Joined: Wed Aug 10, 2005 12:56 pm

Re: DB: duplicate key entry '23' for key 'PRIMARY'

Postby paul » Fri Apr 12, 2013 11:37 am

I ran the patch and upgrade scripts again. It seemed to have upgraded the ojs. The website looks normal; however, all the submissions and published articles are not available (0). I checked the database and noticed something strange for following tables - the new tables (assumed) are empty while the old ones have a suffix "_old" with their original contents.

articles
article_galleys
article_sup_files
issues
notification
notification_setting
published_articles

Something went wrong during database upgrading, I guess. I tried comparing the tables and modified the table columns and renaming the old tables to new ones. Now the website becomes inaccessible.

Please help.

Thanks.

Paul
paul
 
Posts: 97
Joined: Thu Dec 06, 2007 9:58 pm

Re: DB: duplicate key entry '23' for key 'PRIMARY'

Postby asmecher » Fri Apr 12, 2013 11:38 am

Hi Paul,

Yes, that means the upgrade process did not finish successfully. I suggest restoring your database from a pre-upgrade backup and trying again. If you can provide the whole output here, I can suggest next steps.

Regards,
Alec Smecher
Public Knowledge Project Team
asmecher
 
Posts: 9201
Joined: Wed Aug 10, 2005 12:56 pm

Re: DB: duplicate key entry '23' for key 'PRIMARY'

Postby paul » Fri Apr 12, 2013 12:46 pm

I did as you suggested. This time I saw the message "Successfully upgraded to 2.4.2" but I am having the same issues with those tables.
paul
 
Posts: 97
Joined: Thu Dec 06, 2007 9:58 pm

Re: DB: duplicate key entry '23' for key 'PRIMARY'

Postby asmecher » Fri Apr 12, 2013 12:50 pm

Hi Paul,

Did you drop your old database before you reloaded from backup? It's likely that the "..._old" tables are causing problems if they're hanging around from the failed upgrade.

Regards,
Alec Smecher
Public Knowledge Project Team
asmecher
 
Posts: 9201
Joined: Wed Aug 10, 2005 12:56 pm

Next

Return to OJS Technical Support

Who is online

Users browsing this forum: No registered users and 2 guests