Duplicate entry '0' for key 'PRIMARY' postlog when posting threads/replies

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • TheWindows7Site
    Member
    • Jul 2009
    • 44

    [Forum] Duplicate entry '0' for key 'PRIMARY' postlog when posting threads/replies

    I am getting the following database error when creating a thread or posting a reply

    Code:
    Database error in vBulletin 4.1.11:
    
    Invalid SQL:
    
    
                    INSERT INTO postlog
                    (postid, useragent, ip, dateline)
                    VALUES
                    (-1, 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.162 Safari/535.19', 3631170548, 1335073744);
    
    
    MySQL Error   : Duplicate entry '0' for key 'PRIMARY'
    Error Number  : 1062
    Request Date  : Sunday, April 22nd 2012 @ 06:49:04 AM
    Error Date    : Sunday, April 22nd 2012 @ 06:49:04 AM
    Script        : http://mysite.com/newthread.php?do=postthread&f=36
    Referrer      : http://mysite.com/newthread.php?do=newthread&f=36
    IP Address    : 216.xxx.xxx.xxx
    Username      : admin
    Classname     : vB_Database
    MySQL Version : 5.1.60-rel13.1
    I have tried running the following queries



    When I run the queries I get the following error

    Code:
    [B]Error[/B]
    
    [COLOR=#FF0000][FONT=sans-serif][B]SQL query:[/B][/FONT][/COLOR]
    [COLOR=#FF0000][FONT=sans-serif][COLOR=#990099][B]ALTER[/B][/COLOR] [COLOR=#990099][B]TABLE[/B][/COLOR] [COLOR=#008000]`forum`[/COLOR] [COLOR=#990099][B]CHANGE[/B][/COLOR] [COLOR=#008000]`forumid`[/COLOR] [COLOR=#008000]`forumid`[/COLOR] [COLOR=#FF9900]SMALLINT[/COLOR][COLOR=fuchsia]([/COLOR] [COLOR=teal]5[/COLOR] [COLOR=fuchsia])[/COLOR] [COLOR=#0000FF]UNSIGNED[/COLOR] [COLOR=#990099][B]NOT[/B][/COLOR] [COLOR=#990099][B]NULL[/B][/COLOR] [COLOR=#990099][B]AUTO_INCREMENT[/B][/COLOR] [COLOR=fuchsia];[/COLOR]
    
    [/FONT][/COLOR]
    [COLOR=#FF0000][FONT=sans-serif][B]MySQL said: [/B][URL="http://dev.mysql.com/doc/refman/5.1/en/error-messages-server.html"][IMG]https://phpmyadmin.gridhost.co.uk/themes/original/img/b_help.png[/IMG][/URL][/FONT][/COLOR]
    #1075 - Incorrect table definition; there can be only one auto column and it must be defined as a key
    The postlog table looks like this

    Click image for larger version

Name:	Untitled.jpg
Views:	1
Size:	101.9 KB
ID:	3723217

    The forum has Threads1,382Posts13,414

    I have run the repair and optimize tables in admincp and the Fix Unique Indexes and the db error is still persistant.

    There was a recent issue with some of the tables getting corrupted. How can I reset or fix the proper tables to fix this problem?

    Thank you for your assistance.

    When I create a test thread the thread ID's say 0, sometimes -1

    showthread.php?0-test

    showthread.php?0-test&p=0#post0

    I am lost at how to fix this issue.

    The max entry in the post table for post ID is 13548

    I have also run 'Rebuild Thread Information' and it didn't help.

    Also, when I post a thread, I get the error, but when i go back to look at the forum its posted there 20+ times. And when i click on any of them It says

    Code:
    [COLOR=#837E6E]No Thread specified. If you followed a valid link, please notify the administrator[/COLOR]
    and the showthread url ID is 0
    Last edited by TheWindows7Site; Sat 21 Apr '12, 10:10pm.
  • BirdOPrey5
    Senior Member
    • Jul 2008
    • 9613
    • 5.6.3

    #2
    For future reference the problem was all indexes and auto-increments were removed from both the post and thread tables for unknown reasons. Manually fixing the indexes fixed the problem.

    Comment

    Related Topics

    Collapse

    Working...