Not sure why this doesn't happen when saving a node edit form, but with a programmatic node_save() of a node with a primary term assigned, duplicate key warnings on term_node are generated. As the comments say:

// taxonomy_node_save() allows $node->taxonomy to contain tids,
// term objects, or arrays of tids (keyed by vocabulary).  So,
// we can add the PT tid to the end of the array.

But, the code is only handling raw tids and arrays, not objects. The attached patch addresses this.

Comments

moshe weitzman’s picture

Status: Active » Reviewed & tested by the community
sethcohn’s picture

Assigned: Unassigned » sethcohn

+1, I know this stretch of code has some other patches pending on that same bit of logic, so I'll review and combine with this in mind.

rmjiv’s picture

StatusFileSize
new950 bytes

This patch and the one in http://drupal.org/node/604076 are essentially duplicates. They cover slightly different cases for the same problem. Here is a patch for the code I've been running for the past year on our site. It should cover both cases.

EdinburghRob’s picture

Thanks rmjiv,

This patch worked for me.

brianV’s picture

Version: 6.x-1.0 » 6.x-1.x-dev
Status: Reviewed & tested by the community » Fixed

Committed mikeryan's patch to -dev. Both of the two submitted patches did the job; mikeryan's was easier to read for future maintainers.

http://drupal.org/cvs?commit=435604

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

rmjiv’s picture

Assigned: sethcohn » rmjiv
Status: Closed (fixed) » Needs review
StatusFileSize
new540 bytes

Unfortunately mikeryan's patch didn't have a fix that is required for Hierarchical Select support. HS stomps on the keys in the $node->taxonomy array. The values are still there, but it's not keyed by tid anymore. Attached patch works around this.

barraponto’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new850 bytes

worked fine for me. here is a formatted patch to make the mantainers' life easier.
see http://drupal.org/node/1054616 for more on this.