Simple Machines Community Forum

Archived Boards and Threads... => Archived Boards => Install and Upgrade Help => Topic started by: comesee on January 06, 2014, 02:56:51 PM

Title: Duplicate entry '8358500' for key 'PRIMARY' File: c:\htdocs\smf\Sources\Subs-Pos
Post by: comesee on January 06, 2014, 02:56:51 PM
i have this error. how do i solve it.


Duplicate entry '8358500' for key 'PRIMARY'
File: c:\htdocs\smf\Sources\Subs-Post.php
Line: 2002
Title: Re: Duplicate entry '8358500' for key 'PRIMARY' File: c:\htdocs\smf\Sources\Subs-Pos
Post by: Kindred on January 06, 2014, 02:58:20 PM
And what are you trying to DO when you see this error?

Information rather than puzzles, please.
Title: Re: Duplicate entry '8358500' for key 'PRIMARY' File: c:\htdocs\smf\Sources\Subs-Pos
Post by: comesee on January 06, 2014, 07:42:24 PM
when i try to post to the site
Title: Re: Duplicate entry '8358500' for key 'PRIMARY' File: c:\htdocs\smf\Sources\Subs-Pos
Post by: Kindred on January 06, 2014, 09:11:10 PM
wow....  with that many posts, one would assume that your would know how we react to single line answers with no actual details.

SMF version?
URL?
Mods installed?


The error is actually very clear...   hen the system tries to write the new post to your database, it gets an error because the post number is too high and 8358500 has already been used. Since I tend to DOUBT that you actually have 8 million posts...   and this does not happen in a standard install, We have to assume that something which you did to your system has screwed up your site.
Title: Re: Duplicate entry '8358500' for key 'PRIMARY' File: c:\htdocs\smf\Sources\Subs-Pos
Post by: comesee on January 07, 2014, 12:42:51 PM
i have more than 8 million post.  i did not do anything. when it get to this point. i get this error. so i go back to my backup...

how do i correct duplicate key using sql
Title: Re: Duplicate entry '8358500' for key 'PRIMARY' File: c:\htdocs\smf\Sources\Subs-Pos
Post by: Kindred on January 07, 2014, 02:28:40 PM
Quote from: Kindred on January 06, 2014, 09:11:10 PM
wow....  with that many posts, one would assume that your would know how we react to single line answers with no actual details.

SMF version?
URL?
Mods installed?

Title: Re: Duplicate entry '8358500' for key 'PRIMARY' File: c:\htdocs\smf\Sources\Subs-Pos
Post by: Illori on January 07, 2014, 02:36:48 PM
this is basically a duplicate of http://www.simplemachines.org/community/index.php?topic=512432 and i would assume http://www.simplemachines.org/community/index.php?topic=454865

if you cant manage to give us details of what is going on no one will ever be able to help you solve your problem.
Title: Re: Duplicate entry '8358500' for key 'PRIMARY' File: c:\htdocs\smf\Sources\Subs-Pos
Post by: comesee on January 08, 2014, 01:39:25 PM
what is the solution
Title: Re: Duplicate entry '8358500' for key 'PRIMARY' File: c:\htdocs\smf\Sources\Subs-Pos
Post by: Illori on January 08, 2014, 01:40:52 PM
we will say it one more time. you need to provide us with MUCH more information or we will NEVER be able to assist you to solve your issue.
Title: Re: Duplicate entry '8358500' for key 'PRIMARY' File: c:\htdocs\smf\Sources\Subs-Pos
Post by: comesee on January 08, 2014, 10:36:08 PM
i said, when i post. I get that error.. That all.

I have seen it happen before several times.

What is the sql to correct  the error.

THis is an sql solution. I have tried several alternative sql method, it does not work.
Title: Re: Duplicate entry '8358500' for key 'PRIMARY' File: c:\htdocs\smf\Sources\Subs-Pos
Post by: Kindred on January 09, 2014, 10:28:19 AM
and see, that is your problem.
You are assuming things which may or may not be true.

You have not answered any of my actual questions.
SMF version?
Mods installed?
URL?

I will add one as well -- What "alternative sql methods" have you tried?

because, as I said in one of your other threads, there is an SMF site out there with over 50 million posts... and they don't have this issue.

Title: Re: Duplicate entry '8358500' for key 'PRIMARY' File: c:\htdocs\smf\Sources\Subs-Pos
Post by: comesee on January 09, 2014, 01:47:53 PM
Forum version: SMF 2.0.4

the mod is not the reason why it is, it get to this point and i notice the id_topic is set to just 8. i think this is where the problem. it got to the maximum.
Title: Re: Duplicate entry '8358500' for key 'PRIMARY' File: c:\htdocs\smf\Sources\Subs-Pos
Post by: margarett on January 09, 2014, 01:55:35 PM
The (8) is irrelevant for the field size. It's the type of integer that might cause you issues. What type is that?
Title: Re: Duplicate entry '8358500' for key 'PRIMARY' File: c:\htdocs\smf\Sources\Subs-Pos
Post by: margarett on January 09, 2014, 01:59:59 PM
Hummm... Can you paste here some lines around line 2002 from Subs-Post.php? I've been looking at it and the issue might be elsewhere...

Also, please update your forum to latest version ;)
Title: Re: Duplicate entry '8358500' for key 'PRIMARY' File: c:\htdocs\smf\Sources\Subs-Pos
Post by: Chen Zhen on January 09, 2014, 02:24:23 PM
comesee,

  We need to see the code from that line so it would be best for you to post it within bbc code tags here in this thread. The reason is because when you install mods they can displace the code compared to what would be at that line in a default file. Also it could be code from a mod itself in which case we will have no idea what it is without looking at it. You should also list any post related mods that you have installed on your forum.

  Whatever db column is throwing the error, it sounds as though it is set to a signed mediumint but the integer you posted is ever so slightly below that limit which seems puzzling atm. If that were the case & negative values for said db column were not necessary, adjusting it to unsigned will solve your dilemma. If negative values are necessary in that column, it will need to be changed to signed int. We need more info to give you a proper answer else we are just throwing guesses.

MySQL integer types comparison: http://dev.mysql.com/doc/refman/5.0/en/integer-types.html