• Hi Hector

    For the past few days, I’ve been seeing this error in my site’s log file:

    [18-Dec-2014 23:59:04] WordPress database error Duplicate entry ‘23248’ for key ‘PRIMARY’ for query INSERT INTO wp_popularpostssummary
    (postid, pageviews, view_date, last_viewed) VALUES (16774, 1, ‘2014-12-19’, ‘2014-12-19 01:59:04’)
    ON DUPLICATE KEY UPDATE pageviews = pageviews + 1, last_viewed = ‘2014-12-19 01:59:04’; made by do_action(‘wp_ajax_nopriv_update_views_ajax’), call_user_func_array, WordPressPopularPosts->update_views_ajax, WordPressPopularPosts->__update_views

    https://www.ads-software.com/plugins/wordpress-popular-posts/

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author Hector Cabrera

    (@hcabrera)

    Hi Lea,

    I’m unable to reproduce this. Is it the exact same error (same key, post ID, etc)?

    Thread Starter Lea

    (@leac)

    Hi Héctor

    It’s almost the exact same error. The entry is always ‘23248’, but the first value in parenthesis is different:
    VALUES (15263, 1, '2014-12-17', '2014-12-17 22:30:26')
    VALUES (11494, 1, '2014-12-17', '2014-12-17 22:34:53')
    VALUES (4660, 1, '2014-12-17', '2014-12-17 22:38:31')
    and so on..

    Plugin Author Hector Cabrera

    (@hcabrera)

    Sounds like the auto increment field (ID) in your wp_popularpostssummary table has been messed up / disabled. Could you please check that?

    Thread Starter Lea

    (@leac)

    From what I can tell, the ID column is defined to be auto incremented, and the highest id is 23247.

    How can I know if it’s messed up or disabled?

    Thread Starter Lea

    (@leac)

    I might have found a solution. I just want to wait a bit to make sure, and then I’ll come here and update.
    Thank you for helping me identify the problem.

    Thread Starter Lea

    (@leac)

    The solution I found was this:
    I edited the wp_popularpostssummary table to remove the auto increment from the ID column, then immediately edited it to add it back. That returned the table to normal.
    In the past 2 months, this error has returned twice, and both times this is the solution I applied and it worked.
    I don’t know what causes it to happen, so I check my error logs daily :).

    Plugin Author Hector Cabrera

    (@hcabrera)

    Hi Lea!

    Thanks for the input! The only way I know of that an auto-increment field gets stuck is when it reaches its maximum defined value (BIGINT in our case, which should be more than enough). From what I remember, your site isn’t that large (unless something has changed during the past few months hehe).

    I’ll do some research and see what I can find.

    Thread Starter Lea

    (@leac)

    No, my site isn’t that large ??
    And I can see what the number it’s getting stuck on, and it’s far from BIGINT…
    Thank you very much for researching.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘WordPress database error Duplicate entry’ is closed to new replies.