I'm still trying to run this down but haven't figured it out yet. I would really appreciate anyone's tips, suggestions for what is the problem here:

I am guessing it's a DB problem but I have been over it now closely and can't spot anything. If I try to post new nodes I get this error:

user warning: Duplicate entry '0' for key 2 query: INSERT INTO node (vid, type, language, title, uid, status, created, changed, comment, promote, moderate, sticky, tnid, translate) VALUES (0, 'blog', '', 'Friday Test of Dot Org', 2, 1, 1206722055, 1206722055, 2, 0, 0, 0, 0, 0) in /home/comixt/public_html/includes/common.inc on line 3303. 
user warning: Duplicate entry '0' for key 1 query: INSERT INTO node_comment_statistics (nid, last_comment_timestamp, last_comment_name, last_comment_uid, comment_count) VALUES (0, 1206722055, NULL, 2, 0) in /home/comixt/public_html/modules/comment/comment.module on line 606. 
The post could not be saved. 

That then deletes the basic node access table entry (or maybe it's empty the table? there's only one entry in it) - it's weird! Of course that means all the anonymous access is messed up! I add the basic entry for access back to the node access table back in, everything's fine in terms of accessing content but boom! try to add a new node and the circle starts again...

Any ideas? Has this happened to anyone else?

Comments

xerexes’s picture

Ah - I think I understand the problem now a bit but don't understand it really :)

So in adding a new node drupal is trying to give a vid of "0" in the node table (vid is a unique column) and a nid of "0" in the comment statistics table (Nid). This page - http://drupal.org/node/69722 - at Drupal is helpful but it's advice is out of date for V6.1 b/c Drupal doesn't use the sequences table anymore.

The odd thing is this stuff was working on Tues/Wed then "broke" Wed/Thurs and I can't pinpoint any changes that were made to the install. So it's hard to identify a "cause"...

xerexes’s picture

I have fixed/dealt with the above issues (it's always a bit random on the Drupal forums as to what will draw help from others as to what gets ignored!) but I still am encountering the classic "access denied" to nodes based on the node_access table being empty. I can't find anything searching thru drupal.org on this.

This is what's happening - I'm running 6.1. I put into node_access table:

INSERT INTO `node_access` VALUES(0, 0, 'all', 1, 0, 0);

Problem solved, access works. For unknown reasons (haven't identified a cause yet) every few days or so the access denied error pops up and it turns out, because the node_access table is empty.

So the simplest guess is something in my drupal install is emptying the node_access table. Is this happening to anyone else? Any guesses as to what is going on?

Gijs’s picture

I seem to have this error, which began with the upgrade to 6.2

This is on Debian and Postrgresql 8.3

I get all kinds of errors, starting with the main page only visible for a known user and not for anonymous visitors, reversed chronological order for the blog posts, and it is also impossible to add new content:

query: SELECT bx.*, bl.title FROM boxes bx INNER JOIN blocks bl ON bx.bid = bl.delta WHERE bl.module = 'block' AND bx.bid = 3 in /usr/share/drupal-6.2/modules/block/block.module on line 302.

kalesco’s picture

since updating from 6.1 to 6.2 I randomly get the same errors. Access is f*ed up and repairing the node access via the admin panel only helps until I try to create a new node. Then I get the duplicate entry error and access to existing sites is broken again.
Has anyone a fix for this?!

scoorch’s picture

I have the same problem here:

# user warning: Duplicate entry '0' for key 2 query: INSERT INTO node (vid, type, language, title, uid, status, created, changed, comment, promote, moderate, sticky, tnid, translate) VALUES (0, 'article', 'de', 'sdfdsf', 14, 1, 1209462396, 1209462396, 2, 1, 0, 0, 0, 0) in C:\Programme\xampp\htdocs\includes\common.inc on line 3303.

# user warning: Duplicate entry '0' for key 1 query: INSERT INTO node_comment_statistics (nid, last_comment_timestamp, last_comment_name, last_comment_uid, comment_count) VALUES (0, 1209462396, NULL, 14, 0) in C:\Programme\xampp\htdocs\modules\comment\comment.module on line 607.

I used Drupal 6.1. and upgraded to 6.2 hoping this would solve the problem.But it didnt. Let me know if you have a fix!

joha76’s picture

Status: Drupal Version 6.2. - running on a local testserver environment created with EasyPHP2.0b1 (that means: PHP 5.2.0 - Apache 2.2.3 - MySQL 5.0.27 - PhpMyAdmin 2.9.1.1 - SqliteManager 1.2.0)

When creating a node, this happens:

user warning: Duplicate entry '0' for key 2 query: INSERT INTO node (vid, type, language, title, uid, status, created, changed, comment, promote, moderate, sticky, tnid, translate) VALUES (0, 'page', '', 'blib', 1, 1, 1216026745, 1216026745, 0, 0, 0, 0, 0, 0) in E:\EasyPHP2.0b1\www\includes\common.inc on line 3303.

In addition to that, I tend to get this (astonishingly just sometimes):

user warning: Duplicate entry '0' for key 1 query: INSERT INTO node_comment_statistics (nid, last_comment_timestamp, last_comment_name, last_comment_uid, comment_count) VALUES (0, 1216028563, NULL, 1, 0) in E:\EasyPHP2.0b1\www\modules\comment\comment.module on line 607.

Has anybody found a fix for that in the meantime?

J.