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.

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

Postby paul » Fri Apr 12, 2013 1:14 pm

I did start from a fresh pre-upgrade database.
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 1:27 pm

Hi Paul,

OK, but how did you restore from backup? If you just loaded e.g. a .sql.gz file into the database, then the ..._old tables will be left there from the failed upgrade.

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

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

Postby paul » Fri Apr 12, 2013 1:29 pm

I tried again to manually fix the tables. This time I copied the data from old to new. Most of the pages can be displayed but not home and current. There is a list of issues on archives page but when I clicked on the link to any issue, the page cannot be displayed (error). Again, if I log in as editor role, all the submission stats are 0. If I click the in review or in edit links, I get this error:

DB Error: Illegal mix of collations (utf8_unicode_ci,IMPLICIT) and (utf8_general_ci,IMPLICIT) for operation '='
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 1:34 pm

Hi Alec,

I am working on copies of the OJS files and database. I want to make sure there is no problem with the upgrade before I make it online. In another word, I am still having my production OJS live which will not be affected by my upgrade testing.

I make an identical copy of my current database via myphpadmin, and do the upgrade. After each failed database upgrade, I delete this database, and make another copy and try it again.

Appreciate y9our help very much.

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 1:37 pm

Hi Paul,

The collation error message is coming from MySQL; it suggests that you're somehow mixing Latin1 and UTF8 content in your database. I suspect your copy is in Latin1 and your original database is UTF8, or similar.

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

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

Postby paul » Fri Apr 12, 2013 1:39 pm

How do I fix the collation problem? Thanks.
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 2:03 pm

My original (current) database uses utf8_general_ci and gbk_general_ci. At the bottom of the table list, it shows "MyISAM" as type, and "latin1_swedish_ci " as collation.

The upgraded database uses the same mixture of utf8_general_ci and gbk_general_ci; however some tables including those problematic ones may have the same or different collation compared with the original ones. I tried different the database (not table) collations but it didn't help.
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 2:23 pm

Hi Paul,

Are your config.inc.php connection_charset and database_charset options the same in the upgrade installation? OJS doesn't do anything funky with database character sets, so if those settings are the same in the two installations, then the conflict is most likely introduced when you're making a copy.

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

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

Postby paul » Fri Apr 12, 2013 2:36 pm

I use the same config file.
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 3:05 pm

I compared the two databases. OJS 2.3.3 has 99 tables and 2.4.2 has 123. Some tables in 2.4.2 may not be populated. For example, a number of issues related tables are empty. I wonder if this is causing the problem.

Apparently the database problems occur to article and submission related tables because others, e.g., user login, announcements etc, are working just fine.

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 3:10 pm

One of the main reasons I want to upgrade is my hope to get the review invitation email interface working probably with the newer version without going into other trouble. Right now when I send a request to reviewer, I can't add recipients to the CC and BCC fields. In fact, all email addresses fields (including the "To" field") are grayed out and inaccessible. Looks like there is no quick fix. I wonder if you could help me with this too.

Thanks.

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

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

Postby asmecher » Mon Apr 15, 2013 8:18 am

Hi Paul,

That is intentional to ensure that it's not easy for an editor to e.g. send himself credentials for a review. If you like, I can point out the relevant pieces of code.

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

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

Postby paul » Tue Apr 16, 2013 10:31 am

Hi Alec,

Please point me to the code to enable those address fields. Some editors want to make sure the invitations are actually sent out by sending themselves a copy of the invitation email.

Thanks.

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

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

Postby paul » Tue Apr 16, 2013 10:35 am

What are your thoughts about my earlier comments (I compared the two databases. OJS 2.3.3 has 99 tables and 2.4.2 has 123. Some tables in 2.4.2 may not be populated. For example, a number of issues related tables are empty. I wonder if this is causing the problem. Apparently the database problems occur to article and submission related tables because others, e.g., user login, announcements etc, are working just fine.)?

I have a couple of stupid questions: Does the upgrade script populate those new tables with data grabbed from existing tables? What if these data are not available?

Thanks,

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

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

Postby asmecher » Tue Apr 16, 2013 12:30 pm

Hi Paul,

The upgrade script is in charge of creating additional tables and populating them as necessary. There will be a number of additional tables in OJS 2.4.2 and many will be created without content; that's fine.

The code preventing editors from changing the addressing of reviewer emails is in classes/submission/sectionEditor/SectionEditorAction.inc.php:
Code: Select all
$preventAddressChanges = $reviewerAccessKeysEnabled;
You can hard-code this to false in order to enable the fields:
Code: Select all
$preventAddressChanges = false;
I haven't tested this change but it should work OTOH.

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

PreviousNext

Return to OJS Technical Support

Who is online

Users browsing this forum: Bing [Bot] and 3 guests