user warning: Duplicate entry '51-32' for key 1 query: 
INSERT INTO category_hierarchy (cid, parent) VALUES (51, 32) 
in /var/www/html/drupal-4.7.3/includes/database.mysql.inc on line 120.

upgrade.php has been run; how best to diagnose? What changes might have led to the error? Since I'm updating the node, the above query should be an UPDATE, no?

Comments

pjb’s picture

I've had this error as well on stock 4.7.2. I've tracked it down to one of the INSERT statements on either line 455 or 461 of category.module.

455: db_query('INSERT INTO {category_hierarchy} (cid, parent) VALUES (%d, %d)', $node->nid, $parent);
461: db_query('INSERT INTO {category_hierarchy} (cid, parent) VALUES (%d, %d)', $node->nid, $node->cnid);

What confuses me is that it shouldn't be a duplicate row at all due to the previous SQL statement on line 448:

db_query('DELETE FROM {category_hierarchy} WHERE cid = %d', $node->nid);

Unless I'm reading the code wrong, that should have cleared the hierarchy table of any rows with a 'cid' of '$node->nid'. So I'm at a bit of a loss as to why it is hitting a duplicate row violation. Please consider this a seconding of Robert's request for help! Thanks!! :)

bdragon’s picture

Please try again with today's version.
This bug was most likely a side effect of the category_get_parents() problem described in
http://drupal.org/node/76921

Thank you for your patience.
--Brandon

pjb’s picture

Hey thanks! I'll reload with the new module tonight and do some poking and prodding to see if I can reproduce this issue. Thanks to you and all the others who work hard on this module. It's a great addition!

pjb

bdragon’s picture

pjb: Thumbs up or thumbs down?

chud’s picture

I experienced this same error a couple days ago when I upgraded from 4.7.2 to 4.7.3 and upgrade the category module to the latest 4.7 version (October 1, 2006).

Unfortunately the action I took was to disable the taxonomy wrapper (this was something I didn't want to do, but it quite dramatically improved the performance of a site I'm about to launch).

Anyway, I just noticed the file sizes on the CVS and 4.7 category module download packages are slightly different -- is there a difference?

Thanks,
Colin

bdragon’s picture

Status: Active » Closed (duplicate)

Despite this issue being older, marking as duplicate of
http://drupal.org/node/92818.