News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

MySQL script error #1062 - Duplicate entry '47104' for key 'PRIMARY'

Started by khigh, July 31, 2015, 08:02:36 PM

Previous topic - Next topic

khigh

Hi all and thanks for looking. I'll try to explain this as succinctly as possible. I apologize if this isn't the right place, but I'm way over my head with the MySQL

I'm using a crawler converter to try to salvage an administrator abandoned phpbb forum (which hopefully will be converted to SMF). It crawls the site and generates .sql scripts, which I then import into the db/table and it populates them. It's really working surprisingly well. I've imported all of my members and categories, but I keep crapping out on importing the topics. It's always the same error in the same place, too. I did a second crawl and generated a new script thinking a bit may have been corrupted somewhere in the transfer,but no - same exact error in the exact same place, and that's with the data slightly different (half dozen new topics).

Here' s what I'm getting on import. This is all the same forum topic. The conversation is innocuous enough to make public, but I changed the users to "User_1", "User_2", and "User_3". Everything else is verbatim. I'm assuming the problem is shown in this bit. Sorry about the code tag, but there are "quotes" in there and a stright paste kind of blew it all up. You'll probably have to paste it somewhere to view it.

[i][b]SQL query:[/b]

INSERT INTO phpbb_posts (post_id,topic_id,forum_id,poster_id,post_time,poster_ip,post_username,post_edit_time,post_edit_count,post_edit_user,post_subject,post_text,bbcode_uid,post_checksum,bbcode_bitfield,post_edit_reason,post_attachment) VALUES (40355,4747,33,56,1375215120,'','User_1',0,0,0,'finished for the year.','[quote="User_2":1nix0woo]Well you could prepare now by joining the mounted patrol guys downtown :)[/quote:1nix0woo] For some strange reason that just sounds wrong! :shock: GG','1nix0woo','9b5c531d1cfb28981707a6a2702ad15a','gA==','',0), (40357,4747,33,373,1375216560,'','User_2',0,0,0,'finished for the year.','It would to you!','ibm9mips','abf36386a9f820cd3117bfc9c8d6db82','','',0), (40364,4747,33,399,1375223400,'','User_3',0,0,0,'finished for the year.','I think he\'s out of law enforcement and you\'d send him BACK? DOWNTOWN? What are you drinking? . . . . . . . . Can I have some? :D','p2bfm08b','ac9b40be9c18de93a764de5bccb1e[...]

[b]MySQL said: Documentation[/b]

#1062 - Duplicate entry '47104' for key 'PRIMARY'[/i]



Can anyone help? It would make hundreds of very nice people very happy

I've googled the error code, but all the answers lose me by about the third word.

Thanks again for looking.

shawnb61

First guess?   ...And it is a guess...    There is a last-used message # somewhere that needs to be updated to match the last post in your forum.   
Address the process rather than the outcome.  Then, the outcome becomes more likely.   - Fripp

khigh

Quote from: shawnb61 on July 31, 2015, 08:22:30 PM
First guess?   ...And it is a guess...    There is a last-used message # somewhere that needs to be updated to match the last post in your forum.

That's a really good guess from my perspective, which isn't much of a compliment with my knowledge base.

You have to set up the scripts in advance to tell it the top use number so it knows how many members to get, but there are no settings to tell it in advance anything about the posts or topics.

And the posts that get imported seem totally random - one from two days ago, one from three years ago... no rhyme or reason.

khigh

I guess I fixed it!

Not through any mad coding skillz, but luck and determination. It was bugging me that the referenced number, 47104 wasn't anywhere NEAR the snippet being displayed. I'd searched for it over and over and only ever found it really far away in two instances.

I searched for five digit numbers that didn't already exist (hard on a file this big) and came up with one. I replaced one of the 47104s with it, ran it again - different number complaint! Did the same thing to that one... success. It took it and the script completed with no errors.

Had to dink around with my search indexes to see if the content worked properly - so far, so good!

I guess I just got confused that it was displaying text that didn't remotely have anything to do with the error.

Advertisement: