OJS OCS OMP OHS

You are viewing the PKP Support Forum | PKP Home Wiki



ojs2: DB Error: Duplicate entry '4' for key 1

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.

ojs2: DB Error: Duplicate entry '4' for key 1

Postby rajiv » Thu Sep 12, 2013 4:35 am

hi friends,
When re ordering back issues, i got this error,

ojs2: DB Error: Duplicate entry '4' for key 1

Please suggestion what might be going wrong?


Thanks
Rajiv
rajiv
 
Posts: 31
Joined: Tue Dec 18, 2012 2:55 am

Re: ojs2: DB Error: Duplicate entry '4' for key 1

Postby asmecher » Thu Sep 12, 2013 9:24 am

Hi Rajiv,

I suspect there's a database inconsistency in your installation. Can you try turning on the "Debug" setting in config.inc.php just before you click the re-order link, then post the results here?

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

Re: ojs2: DB Error: Duplicate entry '4' for key 1

Postby rajiv » Fri Sep 13, 2013 1:47 am

Hi Alec Smecher,

I got following error when turn on Debug setting in config.inc.php.

Code: Select all
(mysql): SELECT * FROM sessions WHERE session_id = 'vi96v6rveuabkl8bacvhblg3t5'   
________________________________________
________________________________________
(mysql): SELECT * FROM users WHERE user_id = 4   
________________________________________
________________________________________
(mysql): SELECT * FROM user_settings WHERE user_id = '4'   
________________________________________
________________________________________
(mysql): SELECT * FROM journals WHERE path = 'ojs'   
________________________________________
________________________________________
(mysql): SELECT * FROM site   
________________________________________
________________________________________
(mysql): SELECT v.* FROM versions v LEFT JOIN plugin_settings ps ON lower(v.product_class_name) = ps.plugin_name AND ps.setting_name = 'enabled' AND ((journal_id = '7') OR v.sitewide = 1) WHERE v.current = 1 AND (ps.setting_value = '1' OR v.lazy_load <> 1)   
________________________________________
________________________________________
(mysql): SELECT COUNT(*) FROM roles WHERE journal_id = 7 AND user_id = 4 AND role_id = 256   
________________________________________
________________________________________
(mysql): SELECT * FROM notifications WHERE user_id = 4 AND product = 'ojs2' AND context = 7 AND level = 1 ORDER BY date_created DESC   
________________________________________
________________________________________
(mysql): SELECT COUNT(*) FROM roles WHERE journal_id = 7 AND user_id = 4 AND role_id = 256   
________________________________________
________________________________________
(mysql): SELECT COUNT(*) FROM issues i LEFT JOIN custom_issue_orders o ON (o.issue_id = i.issue_id) WHERE i.journal_id = '7' AND i.published = 1 LIMIT 1   
________________________________________
________________________________________
(mysql): SELECT i.* FROM issues i LEFT JOIN custom_issue_orders o ON (o.issue_id = i.issue_id) WHERE i.journal_id = '7' AND i.published = 1 ORDER BY o.seq ASC, i.current DESC, i.date_published DESC LIMIT 0,25   
________________________________________
________________________________________
(mysql): SELECT i.* FROM issues i LEFT JOIN custom_issue_orders o ON (o.issue_id = i.issue_id) WHERE i.journal_id = '7' AND i.published = 1 ORDER BY o.seq ASC, i.current DESC, i.date_published DESC   
________________________________________
________________________________________
(mysql): SELECT * FROM issue_settings WHERE issue_id = '11'   
________________________________________
________________________________________
(mysql): SELECT * FROM issue_settings WHERE issue_id = '10'   
________________________________________
________________________________________
(mysql): SELECT * FROM issue_settings WHERE issue_id = '9'   
________________________________________
________________________________________
(mysql): SELECT * FROM issue_settings WHERE issue_id = '7'   
________________________________________
________________________________________
(mysql): SELECT * FROM issue_settings WHERE issue_id = '6'   
________________________________________
________________________________________
(mysql): SELECT * FROM issue_settings WHERE issue_id = '5'   
________________________________________
________________________________________
(mysql): SELECT * FROM issue_settings WHERE issue_id = '4'   
________________________________________
________________________________________
(mysql): SELECT i.* FROM issues i WHERE journal_id = '7' AND current = 1   
________________________________________
________________________________________
(mysql): SELECT * FROM issue_settings WHERE issue_id = '11'   
________________________________________
________________________________________
(mysql): SELECT COUNT(*) FROM custom_issue_orders WHERE journal_id = '7'   
________________________________________
________________________________________
(mysql): SELECT i.* FROM issues i WHERE journal_id = '7' AND current = 1   
________________________________________
________________________________________
(mysql): SELECT * FROM issue_settings WHERE issue_id = '11'   
________________________________________
________________________________________
(mysql): SELECT i.* FROM issues i WHERE journal_id = '7' AND current = 1   
________________________________________
________________________________________
(mysql): SELECT * FROM issue_settings WHERE issue_id = '11' 





UPDATE sessions SET user_id = 4, ip_address = '::1', user_agent = 'Mozilla/5.0 (Windows NT 6.1; rv:23.0) Gecko/20100101 Firefox/23.0', created = 1379061747, last_used = 1379061881, remember = 0, data = 'userId|s:1:\"4\";username|s:5:\"rajiv\";', acting_as = 0 WHERE session_id = 'vi96v6rveuabkl8bacvhblg3t5




Thanks
Rajiv
rajiv
 
Posts: 31
Joined: Tue Dec 18, 2012 2:55 am

Re: ojs2: DB Error: Duplicate entry '4' for key 1

Postby asmecher » Fri Sep 13, 2013 9:46 am

Hi Rajiv,

This debug information doesn't appear to include the query that resulted in the error message -- unless it's the "session" update I see at the end, which would be strange because that query is supposed to run on all pages. Did it resolve it self or is it still happening?

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

Re: ojs2: DB Error: Duplicate entry '4' for key 1

Postby rajiv » Fri Sep 13, 2013 9:22 pm

hi Alec Smecher,

Its still happening in website, so how to over come from this problem. any solution?


Thanks
Rajiv
rajiv
 
Posts: 31
Joined: Tue Dec 18, 2012 2:55 am

Re: ojs2: DB Error: Duplicate entry '4' for key 1

Postby asmecher » Fri Sep 13, 2013 11:35 pm

Hi Rajiv,

On all pages, or just the reorder action?

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

Re: ojs2: DB Error: Duplicate entry '4' for key 1

Postby rajiv » Sat Sep 14, 2013 10:09 pm

hi Alec Smecher,

This things happening in all pages of website. so what to do?


Thanks

Rajiv
rajiv
 
Posts: 31
Joined: Tue Dec 18, 2012 2:55 am

Re: ojs2: DB Error: Duplicate entry '4' for key 1

Postby asmecher » Mon Sep 16, 2013 7:29 am

Hi Rajiv,

Can you check if your server uses APC? If so, you may need to patch http://pkp.sfu.ca/bugzilla/show_bug.cgi?id=8151.

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

Re: ojs2: DB Error: Duplicate entry '4' for key 1

Postby jamilj » Sat Sep 21, 2013 4:23 pm

I'm having this same problem and I now know it is a server issue because after recreating a fresh database and install, I still get the error when I try to import articles. Specifically:

DB Error: Duplicate entry '1-1' for key 'custom_section_orders_pkey'

For others having this problem, you apparently must apply this patch: Bug #8151: Investigate APC bug workaround patch, which can be found on the OJS 2.4.2 Recommended Patches page.
jamilj
 
Posts: 38
Joined: Sun Aug 25, 2013 10:36 pm

Re: ojs2: DB Error: Duplicate entry '4' for key 1

Postby jamilj » Sat Sep 21, 2013 4:45 pm

Hello Alec,

When I try to apply this patch nothing happens. Here is the code I'm using:

Code: Select all
patch -p1 8fda4d6c6facaac21afac4bd3e76ef2a4a8b7f2b.diff


I'm running this within the lib/pkp directory. I also tried using the link instead of uploading the file. Can you please explain how this works? And, once again, I'd be happy to update the wiki as I assume that applying fixes like this are not intuitive to most people here.

Thanks
jamilj
 
Posts: 38
Joined: Sun Aug 25, 2013 10:36 pm

Re: ojs2: DB Error: Duplicate entry '4' for key 1

Postby asmecher » Sat Sep 21, 2013 7:36 pm

Hi jamilj,

The problem you're seeing is different from the one Rajiv was reporting; I suspect you're seeing something like this. (However, your invocation for the "patch" utility isn't correct -- you usually pipe patch files into the patch tool rather than specifying the patch file on the command line. Have a look at the patch manpage.)

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

Re: ojs2: DB Error: Duplicate entry '4' for key 1

Postby jamilj » Sun Sep 22, 2013 1:31 pm

Hi Alec,

You are absolutely correct. That was the problem: multiple, discontinuous instances of the same section in the same issue.

Many thanks for your help.
jamilj
 
Posts: 38
Joined: Sun Aug 25, 2013 10:36 pm


Return to OJS Technical Support

Who is online

Users browsing this forum: Baidu [Spider], Google [Bot] and 3 guests