Announcement

Collapse
No announcement yet.

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

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • [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

    http://www.vbulletin.com/docs/html/mysql_duplicatekey

    When I run the queries I get the following error

    Code:
    Error
    
    SQL query:
    ALTER TABLE `forum` CHANGE `forumid` `forumid` SMALLINT( 5 ) UNSIGNED NOT NULL AUTO_INCREMENT ;
    
    
    MySQL said: 
    #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:
    No Thread specified. If you followed a valid link, please notify the administrator
    and the showthread url ID is 0
    Last edited by TheWindows7Site; Sat 21st Apr '12, 11:10pm.

  • #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...
    X