TIP: how I solved query failed / Duplicate entry in comments

Do something cool with CMS? Show us ...
This board is for 'Answers', and the discussion of answers... Not for questions.
Post Reply
User avatar
Gregor
Power Poster
Power Poster
Posts: 1874
Joined: Thu Mar 23, 2006 9:25 am

TIP: how I solved query failed / Duplicate entry in comments

Post by Gregor »

Hi,

In the comments module I got the following error:
DEBUG: query failed
SQL: INSERT INTO cms_module_comments (comment_id, page_id, comment_title, comment_author, author_email, author_website, comment_data, comment_date, module_name, create_date, modified_date, active, author_notify, ip) VALUES (************)
ERROR: Duplicate entry '17' for key 1
What I did to solve it, is I exported the table 'cms_module_comments_seq' to an ASCII-file with all sql-statements. I noticed that there where, in my case, three records, all with a different sequence number. I also noticed that the highest number in that table did not match the highest number of the key in the comments table. So what I did I edited the seq-file, the number in that file, and changed that number to the highest key-number of the comments table. And afterwards I imported the sql-statements into the table. I checked the table and deleted the obsolete records so that only one records is left with the highest number.

Hope this helps.

Gregor
Post Reply

Return to “Tips and Tricks”