After upgrading from 6.4 to 6.6, Drupal no longer accepts posts. When attempting, I get the error messages below. As you can see, I am using the PostgreSQL backend:

warning: pg_query() [function.pg-query]: Query failed: ERROR: duplicate key value violates unique constraint "node_revisions_pkey" in /u/mok/public_html/includes/database.pgsql.inc on line 138.
user warning: query: INSERT INTO node_revisions (nid, uid, title, body, teaser, log, timestamp, format) VALUES (0, 1, 'This is test title', 'Test content. Yikes!', 'Test content. Yikes!', '', 1225897441, 2) in /u/mok/public_html/includes/common.inc on line 3324.
warning: pg_query() [function.pg-query]: Query failed: ERROR: duplicate key value violates unique constraint "node_vid_idx" in /u/mok/public_html/includes/database.pgsql.inc on line 138.
user warning: query: INSERT INTO node (vid, type, language, title, uid, status, created, changed, comment, promote, moderate, sticky, tnid, translate) VALUES (0, 'blog', '', 'This is test title', 1, 1, 1225897441, 1225897441, 2, 1, 0, 0, 0, 0) in /u/mok/public_html/includes/common.inc on line 3324.
warning: pg_query() [function.pg-query]: Query failed: ERROR: duplicate key value violates unique constraint "node_comment_statistics_pkey" in /u/mok/public_html/includes/database.pgsql.inc on line 138.
user warning: query: INSERT INTO node_comment_statistics (nid, last_comment_timestamp, last_comment_name, last_comment_uid, comment_count) VALUES (0, 1225897441, NULL, 1, 0) in /u/mok/public_html/modules/comment/comment.module on line 607.
The post could not be saved.

I can see that there is a duplicate key problem. Apparently Drupal attempts to use nid = 0 after the upgrade, which is of course not allowed. How can I fix this?

Cheers,
Morten

Comments

mok000’s picture

I was able to solve my problem by executing two SQL statements on my Drupal database, described here:

http://drupal.org/node/301818

Tresler’s picture

Assigned: Unassigned » Tresler
Status: Active » Closed (duplicate)

Indeed. Looks like a duplicate to me.