Occurred running Drupal 6.4 using a database migrated from Drupal 5

The 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, 'page', 'es', 'eee', 1, 1, 1222437644, 1222437644, 2, 1, 0, 0, 0, 0) in /var/www/webapps/drupal6/includes/common.inc on line 3318.
# 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, 1222437644, NULL, 1, 0) in /var/www/webapps/drupal6/modules/comment/comment.module on line 607.

Apparently is produced by a problem during database upgrade, because auto_increment is not set for node_revisions table.

Check if 'vid' is PRIMARY KEY on 'node_revisions' and also check that is set to 'auto_increment'

If not try this to fix it:

Obtain last node ID

SELECT max( nid ) FROM `node` 

And sum 1 to the number obtained from previous query and replace YOUR_NUMBER with it and run:

ALTER TABLE `node_revisions` ADD PRIMARY KEY ( `vid` )
ALTER TABLE `node_revisions` CHANGE `vid` `vid` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT
ALTER TABLE `node` AUTO_INCREMENT=YOUR_NUMBER
ALTER TABLE `node_revisions` AUTO_INCREMENT=YOUR_NUMBER

This Works

I have also had this issue running 6.10 (never upgraded from drupal 5), and can confirm running

SELECT max( nid ) FROM `node` 
ALTER TABLE `node` AUTO_INCREMENT=YOUR_NUMBER
ALTER TABLE `node_revisions` AUTO_INCREMENT=YOUR_NUMBER

fixed the issue.

Comments

udvranto’s picture

<?php
// http://drupal.org/node/313908
$result = db_query("SELECT MAX(nid) FROM {node}");
$maxnid = db_result($result);
//$result = db_query("SELECT MAX(vid) FROM {node}");
//$maxvid = db_result($result);

db_query("ALTER TABLE {node_revisions} ADD PRIMARY KEY ( vid  )");
db_query("ALTER TABLE {node_revisions} CHANGE vid vid INT(10) UNSIGNED NOT NULL AUTO_INCREMENT");
db_query("ALTER TABLE {node} AUTO_INCREMENT=%d",($maxnid+1));
db_query("ALTER TABLE {node_revisions} AUTO_INCREMENT=%d",($maxnid+1));
?>
holeepassion’s picture

user warning: Duplicate entry 'themes/alphorn/alphorn.info' for key 1 query: INSERT INTO system (name, owner, info, type, filename, status, throttle, bootstrap) VALUES ('alphorn', 'themes/engines/phptemplate/phptemplate.engine', 'a:11:{s:4:\"name\";s:7:\"Alphorn\";s:11:\"description\";s:66:\"Tableless, recolorable, multi-column, fluid width theme (default).\";s:7:\"version\";s:4:\"6.15\";s:4:\"core\";s:3:\"6.x\";s:6:\"engine\";s:11:\"phptemplate\";s:7:\"regions\";a:10:{s:6:\"slider\";s:6:\"Slider\";s:4:\"left\";s:12:\"left sidebar\";s:5:\"right\";s:13:\"right sidebar\";s:7:\"content\";s:7:\"Content\";s:5:\"news1\";s:13:\"Footer News 1\";s:5:\"news2\";s:13:\"Footer News 2\";s:5:\"news3\";s:13:\"Footer News 3\";s:5:\"news4\";s:13:\"Footer News 4\";s:11:\"footer_menu\";s:11:\"Footer menu\";s:9:\"copyright\";s:9:\"Copyright\";}s:11:\"stylesheets\";a:2:{s:3:\"all\";a:3:{s:13:\"css/reset.css\";s:28:\"themes/alphorn/css/reset.css\";s:12:\"css/grid.css\";s:27:\"themes/alphorn/css/grid.css\";s:18:\"css/typography.css\";s:33:\"themes/alphorn/css/typography.css\";}s:5:\"print\";a:1:{s:13:\"css/print.css\";s:28:\"themes/alphorn/css/print.css\";}}s:7:\"scripts\";a:3:{s:22:\"js/jquery.cycle.all.js\";s:37:\"themes/alphorn/js/jquery.cycle.all.js\";s:25:\"js/supersleight.plugin.js\";s:40:\"themes/alphorn/js/supersleight.plugin.js\";s:12:\"js/custom.js\";s:27:\"themes/alphorn/js/custom.js\";}s:8:\"features\";a:10:{i:0;s:20:\"comment_user_picture\";i:1;s:7:\"favicon\";i:2;s:7:\"mission\";i:3;s:4:\"logo\";i:4;s:4:\"name\";i:5;s:17:\"node_user_picture\";i:6;s:6:\"search\";i:7;s:6:\"slogan\";i:8;s:13:\"primary_links\";i:9;s:15:\"secondary_links\";}s:10:\"screenshot\";s:29:\"themes/alphorn/screenshot.png\";s:3:\"php\";s:5:\"4.3.5\";}', 'theme', 'themes/alphorn/alphorn.info', 0, 0, 0) in /home/malebod1/public_html/peacebids.com/modules/drupal-6.15/modules/system/system.module on line 822.

amongst many duplicate entry that I have ... it seems to relate to themes . wonder why even though I only use one theme ????

I found that sometimes they are ok, sometimes they are not. I noticed that they could be due to the fact that sometimes when you click on a link on the page, it locked me out for some reasons. Why does this happen ? Why doesn't it recognise the logged in users ?

Could somebody show me how to do this please ?

Not sure how to do the PHP script etc ????

Should I copy other duplicate messages here as well ???? They all have the end bit with line 822 it seems ...

Thanks

Thanks

holeepassion’s picture

* warning: array_map() [function.array-map]: Argument #2 should be an array in /home/malebod1/public_html/peacebids.com/modules/drupal-6.15/modules/system/system.module on line 1015.
* warning: array_keys() [function.array-keys]: The first argument should be an array in /home/malebod1/public_html/peacebids.com/includes/theme.inc on line 1771.
* warning: Invalid argument supplied for foreach() in /home/malebod1/public_html/peacebids.com/includes/theme.inc on line 1771.

holeepassion’s picture

please ?

not sure where to start .. I do not understand the suggestions above ?

Paul BC’s picture

I got exactly the same error message for every theme i installed. Here are two of the messages:

user warning: Duplicate entry 'themes/pushbutton/pushbutton.info' for key 1 query: INSERT INTO drupal_system (name, owner, info, type, filename, status, throttle, bootstrap) VALUES ('pushbutton', 'themes/engines/phptemplate/phptemplate.engine', 'a:13:{s:4:\"name\";s:10:\"Pushbutton\";s:11:\"description\";s:52:\"Tabled, multi-column theme in blue and orange tones.\";s:7:\"version\";s:4:\"6.16\";s:4:\"core\";s:3:\"6.x\";s:6:\"engine\";s:11:\"phptemplate\";s:7:\"project\";s:6:\"drupal\";s:9:\"datestamp\";s:10:\"1267662008\";s:7:\"regions\";a:5:{s:4:\"left\";s:12:\"Left sidebar\";s:5:\"right\";s:13:\"Right sidebar\";s:7:\"content\";s:7:\"Content\";s:6:\"header\";s:6:\"Header\";s:6:\"footer\";s:6:\"Footer\";}s:8:\"features\";a:10:{i:0;s:20:\"comment_user_picture\";i:1;s:7:\"favicon\";i:2;s:7:\"mission\";i:3;s:4:\"logo\";i:4;s:4:\"name\";i:5;s:17:\"node_user_picture\";i:6;s:6:\"search\";i:7;s:6:\"slogan\";i:8;s:13:\"primary_links\";i:9;s:15:\"secondary_links\";}s:11:\"stylesheets\";a:1:{s:3:\"all\";a:1:{s:9:\"style.css\";s:27:\"themes/pushbutton/style.css\";}}s:7:\"scripts\";a:1:{s:9:\"script.js\";s:27:\"themes/pushbutton/script.js\";}s:10:\"screenshot\";s:32:\"themes/pushbutton/screenshot.png\";s:3:\"php\";s:5:\"4.3.5\";}', 'theme', 'themes/pushbutton/pushbutton.info', 1, 0, 0) in /mnt/w0803/d44/s29/b031c4ea/www/bu/modules/system/system.module on line 822.

user warning: Duplicate entry 'themes/garland/garland.info' for key 1 query: INSERT INTO drupal_system (name, owner, info, type, filename, status, throttle, bootstrap) VALUES ('garland', 'themes/engines/phptemplate/phptemplate.engine', 'a:13:{s:4:\"name\";s:7:\"Garland\";s:11:\"description\";s:66:\"Tableless, recolorable, multi-column, fluid width theme (default).\";s:7:\"version\";s:4:\"6.16\";s:4:\"core\";s:3:\"6.x\";s:6:\"engine\";s:11:\"phptemplate\";s:11:\"stylesheets\";a:2:{s:3:\"all\";a:1:{s:9:\"style.css\";s:24:\"themes/garland/style.css\";}s:5:\"print\";a:1:{s:9:\"print.css\";s:24:\"themes/garland/print.css\";}}s:7:\"project\";s:6:\"drupal\";s:9:\"datestamp\";s:10:\"1267662008\";s:7:\"regions\";a:5:{s:4:\"left\";s:12:\"Left sidebar\";s:5:\"right\";s:13:\"Right sidebar\";s:7:\"content\";s:7:\"Content\";s:6:\"header\";s:6:\"Header\";s:6:\"footer\";s:6:\"Footer\";}s:8:\"features\";a:10:{i:0;s:20:\"comment_user_picture\";i:1;s:7:\"favicon\";i:2;s:7:\"mission\";i:3;s:4:\"logo\";i:4;s:4:\"name\";i:5;s:17:\"node_user_picture\";i:6;s:6:\"search\";i:7;s:6:\"slogan\";i:8;s:13:\"primary_links\";i:9;s:15:\"secondary_links\";}s:7:\"scripts\";a:1:{s:9:\"script.js\";s:24:\"themes/garland/script.js\";}s:10:\"screenshot\";s:29:\"themes/garland/screenshot.png\";s:3:\"php\";s:5:\"4.3.5\";}', 'theme', 'themes/garland/garland.info', 1, 0, 0) in /mnt/w0803/d44/s29/b031c4ea/www/bu/modules/system/system.module on line 822.

Have anybody got an answer to this?

Paul

ClearXS’s picture

same errors... Only copy the first error message, because of many duplicates for every theme 2 times:
user warning: Duplicate entry 'themes/garland/garland.info' for key 'PRIMARY' query: INSERT INTO ....system (name, owner, info, type, filename, status, throttle, bootstrap) VALUES ('garland', 'themes/engines/phptemplate/phptemplate.engine', 'a:15:{s:4:\"name\";s:7:\"Garland\";s:11:\"description\";s:66:\"Tableless, recolorable, multi-column, fluid width theme (default).\";s:7:\"version\";s:4:\"6.17\";s:4:\"core\";s:3:\"6.x\";s:6:\"engine\";s:11:\"phptemplate\";s:11:\"stylesheets\";a:2:{s:3:\"all\";a:1:{s:9:\"style.css\";s:24:\"themes/garland/style.css\";}s:5:\"print\";a:1:{s:9:\"print.css\";s:24:\"themes/garland/print.css\";}}s:7:\"project\";s:6:\"drupal\";s:9:\"datestamp\";s:10:\"1275505216\";s:7:\"regions\";a:5:{s:4:\"left\";s:12:\"Left sidebar\";s:5:\"right\";s:13:\"Right sidebar\";s:7:\"content\";s:7:\"Content\";s:6:\"header\";s:6:\"Header\";s:6:\"footer\";s:6:\"Footer\";}s:8:\"features\";a:10:{i:0;s:20:\"comment_user_picture\";i:1;s:7:\"favicon\";i:2;s:7:\"mission\";i:3;s:4:\"logo\";i:4;s:4:\"name\";i:5;s:17:\"node_user_picture\";i:6;s:6:\"search\";i:7;s:6:\"slogan\";i:8;s:13:\"primary_links\";i:9;s:15:\"secondary_links\";}s:7:\"scripts\";a:1:{s:9:\"script.js\";s:24:\"themes/garland/script.js\";}s:10:\"screenshot\";s:29:\"themes/garland/screenshot.png\";s:3:\"php\";s:5:\"4.3.5\";s:21:\"_hacked_info_filename\";s:27:\"themes/garland/garland.info\";s:23:\"_hacked_is_cvs_checkout\";b:0;}', 'theme', 'themes/garland/garland.info', 0, 0, 0) in .../modules/system/system.module on line 822.

I'm not sure if I always had them (so now and then, but disappearing on reloading the page), or when my site was growing with many modules and themes in the folders. Anyway, the problem got less, when I disabled the themes that I don't use.

Then I one time installed some engine and removed it later. I even removed an engine in the core folder, because I thought it was the one I installed additionally and caused the error, but it was an original core one. So I extracted the drupal verson another time and copied that php engine. But these errors keep occuring (so now and then). Maybe a page load error, or a remnant of something?