I keep getting this error when I submit a story using the Category module.

user warning: Duplicate entry '1-34' for key 1 query: INSERT INTO term_node (nid, tid) VALUES (34, 1) in /home/<my drupal directory>/includes/database.mysql.inc on line 172.

The hierarchy I'm attempting to set up is for a site that reviews perfumes and related accoutrements. I want perfume reviews to have a definite category: Review -> Perfume, but also to have free tagging below this level to relate different manufacturers/characteristics/types to each other.

Here's how I have the container system set up (square brackets represent containers):

[ARTICLES]
   -[REVIEWS] (required)
      -Other Stuff
      -Perfume
         -[TYPES] (hidden, free-tag)

So, what could be causing this? I remember that I tried to uninstall Category at one point and go back to Taxonomy, but that I couldn't or didn't want to, and reversed it.

Comments

ianchan’s picture

Priority: Normal » Critical

Same issue for me. I looked at the table category_node and the cids are inserted correctly. However, in the term_node table the query inserts the tid of 1 whereas it should have inserted 8 and 48 for the node in question. I think "duplicate entry" is coming up because it tries to insert the tid of 1, twice, for the same node.

The Drupal log error mesage is "Duplicate entry '1-299' for key 1 query: taxonomy_node_save INSERT INTO term_node (nid, tid) VALUES (299, 1) in /var/www/htdocs/360/includes/database.mysql.inc on line 172."

I marked this critical as our users are creating content and then cannot find the content after posting. I tired to downgrade to 5.x.1.1 and the same issue occurs.

Thanks for your help.

green monkey’s picture

Version: 5.x-1.x-dev » 5.x-1.1

Drupal 5.1

same error

ianchan’s picture

The solution posted on http://drupal.org/node/121399 resolved the issue for our Drupal 5.x install. I checked the term_node table and new pages created after the fix are inserted with the correct tid.

sjh-1’s picture

I have added a patch that should fix this issues at #19 in http://drupal.org/node/87669#comment-225000 It seems to be caused by assigning the category structure to the taxonomy field, without adding the tid element to the structure.

bdragon’s picture

Status: Active » Closed (duplicate)

Marking as duplicate of http://drupal.org/node/87669.

Thank you for your report.
--Brandon