Greetings,
I have a repeated Category module-related problem.
Summary: when I add/edit multiple-inheritance category/container (multiple parents - that always results in an error), or when I update category with related categories set, I receive something like this:
Duplicate entry '26-19' for key 1 query: INSERT INTO category_hierarchy (cid, parent) VALUES (26, 19) in /home/cckb/public_html/includes/database.mysql.inc on line 120.
It results in either category unable to be modified, or, at least, its menu position/title/etc unable to change. The only workaround is to delete the category entirely and try to create it anew, avoiding multiple parents and not specifying related categories.
But that's rather ugly. May I ask to attend to this problem?
Drupal version: 4.7.2
All the best,
Konstantin
| Comment | File | Size | Author |
|---|---|---|---|
| #8 | cat_dup_entry.gif | 12.21 KB | venkat-rk |
Comments
Comment #1
jofinneg commentedI have the same problem.
In phpmyadmin, I can see the following errors in the database under:
Category_node
Category_hierarchy
Category_cont_distatnt
each are all followed with the warning: "Primary and Index keys should not both be set for column 'cid'.
This has caused some strange duplicate errors, and I'm very interested in finding out what's going on.
Thank you,
John Finnegan
Comment #2
jofinneg commentedI went into the database and deleted the keyname 'nid' from drupal_category_hierarchy.
The error message is now gone, but I wonder what kind of monster I've unleashed.
Comment #3
jsenich commentedThis looks like the problem logic is here at around line 453 of category.module:
There are duplicate values in the $node->parents array so the second time through the loop is inserting the duplicate value and throwing the error. I'm not sure exactly what the code is supposed to since this if the first time that I've looked at the it, but I think the fix would be to change the block of code to this to make sure that $parent is unique:
Comment #4
forngren commented(pithy comment to get me subscribed)
Can perhaps this help? http://drupal.org/node/69722
Comment #5
ansorg commentedgot similar errors in category_cont_distant and category_menu_map
removed the INDEX on cid in the table category_cont_distant
did not change anything in category_menu_map
no errors after that. But I just startet building my category tree ... let's see what will happen :)
Comment #6
ansorg commentednope, didn't help. getting errors like this all the time now
user warning: Duplicate entry '1-0' for key 1 query: INSERT INTO d_category_cont_distant (cid, allowed_parent) VALUES (1, '0') in /kunden/ja-web.de/x-plane/drupal/includes/database.mysql.inc on line 120.
user warning: Duplicate entry '1' for key 1 query: INSERT INTO d_category_menu_map (nid, mid) VALUES (1, 68) in /kunden/ja-web.de/x-plane/drupal/includes/database.mysql.inc on line 120.
Comment #7
venkat-rk commentedJaza, I recollect that you wanted a more accurate description of the context in which such errors occured. Here is one:
When I tried to make HC-1 the distant parent of HC-2 so that all the HC-2 categories have HC-1's category as the parent, I got a huge list of the duplicate entry errors with a reference to category_menu_map. When I reset HC-2 to have its own container as the distant parent, I was hit by a similar list of duplicate entry errors. Hope this helps.
I had selected the hidden container name without the asterisk.
Comment #8
venkat-rk commentedI forgot the screenshot. Also notice how the error dumps additional menu entries in the navigation menu? They were not there before.
Comment #9
Bèr Kessels commentedsubscribe to this thread
Comment #10
Bèr Kessels commentedhttp://drupal.org/node/74431 was marked dupe of this thread
Comment #11
Bèr Kessels commentedIt looks like the issue comes from a wrongly crafted array. A solution for that array can be found in this patch by bdragon.