I needed to copy on top of fresh Drupal installation only some fields from the old database. In particular I needed to continue on a new site with old nodes and comments. So I have successfully copied all the nodes and comments and got everything displayed correctly on the screen, i.e. number of nodes, comment counts for every nodes, etc. The problem is when I add new comment anywhere on new site it gives this error:
user warning: Duplicate entry '36' for key 1 query: INSERT INTO blog_comments (cid, nid, pid, uid, subject, comment, format, hostname, timestamp, status, score, users, thread, name, mail, homepage) VALUES (36, 9355, 0, 1, 'dfsd', 'dfsd', 1, '76.126.223.92', 1208609200, 0, 0, 'a:1:{i:0;i:0;}', '0l/', 'admin', '', '') in /home/mysite/public_html/includes/database.mysql.inc on line 172.
Basically, it is counting from anew and in this case trying to add comment number 36, while number of comments from old database is 38,328. So instead of 36th comment, it is supposed to add 38,329th comment.
I made sure to copy everything that I thought is relevant to counts of nodes and comments, namely:
comments
node
node_comment_statistics
node_revisions
users
And I made sure to copy all the tables with Add AUTO_INCREMENT value checked on.
What else I need to copy to make my new Drupal installation to continue to count from total number of nodes and comments of old database.
Comments
I have just tried to add a
I have just tried to add a new node and run onto the same problem:
Can't understand where Drupal is hiding node and comments counts, all the needed tables were copied with Auto_Increment checked on, as I said above. I wonder what other tables are involved in counting process?
I would really appreciate if
I would really appreciate if someone could share an advice on this issue, please.
Sequences
You need to reset the count in the sequences table. A value called "comments_cid"
--
John Forsythe
Need reliable Drupal hosting?
This is a resolution if
This is a resolution if anyone else runs onto the same issue:
Thanks
Hello,
thanks for this solution - I was really near to give up...
Greetings,
Mika Pflüger