Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I've got it each time when updating my node (type job-posting):
user warning: Duplicate entry '258-4033' for key 1 query: INSERT INTO term_node (nid, vid, tid) VALUES (1424, 4033, 258) in /home/sites/co.uk/public_html/modules/taxonomy/taxonomy.module on line 694.
user warning: Duplicate entry '259-4033' for key 1 query: INSERT INTO term_node (nid, vid, tid) VALUES (1424, 4033, 259) in /home/sites/co.uk/public_html/modules/taxonomy/taxonomy.module on line 694.
user warning: Duplicate entry '268-4033' for key 1 query: INSERT INTO term_node (nid, vid, tid) VALUES (1424, 4033, 268) in /home/sites/co.uk/public_html/modules/taxonomy/taxonomy.module on line 694.
user warning: Duplicate entry '272-4033' for key 1 query: INSERT INTO term_node (nid, vid, tid) VALUES (1424, 4033, 272) in /home/sites/co.uk/public_html/modules/taxonomy/taxonomy.module on line 694.
user warning: Duplicate entry '273-4033' for key 1 query: INSERT INTO term_node (nid, vid, tid) VALUES (1424, 4033, 273) in /home/sites/co.uk/public_html/modules/taxonomy/taxonomy.module on line 694.
user warning: Duplicate entry '276-4033' for key 1 query: INSERT INTO term_node (nid, vid, tid) VALUES (1424, 4033, 276) in /home/sites/co.uk/public_html/modules/taxonomy/taxonomy.module on line 694.
It's similar to: #20133: Latest taxonomy.patch and latest taxonomy (CVS) module result in error but I'm not using Taxonomy Access Control
Any suggestions?
Comment | File | Size | Author |
---|---|---|---|
#52 | duplicate_entry_for_taxonomy_sql_query-361509.patch | 603 bytes | chrisns |
#22 | autotag-1.17.patch | 658 bytes | Anonymous (not verified) |
Comments
Comment #1
kenorb CreditAttribution: kenorb commentedComment #2
Dave ReidWhat other taxonomy-type modules are you using?
Comment #3
apadernoComment #4
kenorb CreditAttribution: kenorb commentedAd (enabled),
Taxonomy Autotagger (autotag) (enabled),
Forum (enabled),
Hierarchical Select Taxonomy (enabled),
Taxonomy translation (enabled),
Image Gallery (enabled),
Tagadelic (enabled),
Taxonomy Import/Export via XML (enabled),
Text Ad (enabled),
Advanced Forum (enabled),
Forum Thread (enabled)
Can be related to:
http://drupal.org/node/283358#comment-929341 (it's on 5.x)
I'm using 6.x.
Comment #5
kenorb CreditAttribution: kenorb commentedComment #6
apadernoI would try to disable those modules one by one, and see when the problem disappear.
Comment #7
apadernoI am sorry; it's the usual problem with adding two comments at the same time.
Comment #8
kenorb CreditAttribution: kenorb commentedYes, it's Auto Tagging problem.
After disabling it, problem disappears.
Comment #9
kenorb CreditAttribution: kenorb commentedComment #10
apadernoComment #11
sdrycroft CreditAttribution: sdrycroft commentedCritical? Really, these look like warnings to me. I know what is causing them, and will find a fix at some point, for now, don't worry.
Comment #12
sdrycroft CreditAttribution: sdrycroft commentedThis may actually be fixed in the latest version. Can users please try it, and let me know if they still get the warnings as before, and if so, what they did to receive the warnings.
Thanks in advance.
Comment #13
Anonymous (not verified) CreditAttribution: Anonymous commentedThey
aremay say warning but it is a misnomer. It is actually an error. IMO, though this is a bug with taxonomy_node_save() since it is that core function that is giving the error.From what I can tell, when $node->taxonomy exists with data; this issue happens. Also, {autotag} table is always empty, should it contain data? I think what should happen is autotag needs to add the missing terms to $node->taxonomy and then node_save($node) rather than call taxonomy_node_save(). This is at least a normal priority.
Comment #14
Anonymous (not verified) CreditAttribution: Anonymous commented@sdrycroft: Unable to tell if the issue is fixed because of #368520: table term_lowername doesn't exist.
Comment #15
Anonymous (not verified) CreditAttribution: Anonymous commentedI'm going crazy here. I can't see how this issue is the fault of autotag. The first thing that taxonomy_node_save does is call taxonomy_node_delete_revision which calls
Where does that go wrong? Debugging, more later.
Comment #16
Anonymous (not verified) CreditAttribution: Anonymous commentedI found the issue:
From taxonomy_node_save():
And $terms contains:
Because $terms contains both the objects and an array of tids; taxonomy_node_save is saving the term_node data twice. So, the question now is, why does autotag do
in the autotag_nodeapi function? Should this only be done for 'insert' and not for 'update'?
Comment #17
sdrycroft CreditAttribution: sdrycroft commentedApologies for taking some time to reply to this. Thanks for the work earnie, sadly I already knew that was the issue, but am now having difficulty in recreating it on my site. Can somebody please try 6.x-1.17 and let me know if they're still experiencing this, and if so, how to recreate the issue.
Cheers.
Comment #18
Anonymous (not verified) CreditAttribution: Anonymous commentedI installed the lowername module and upgraded to 1.17. Then I ran cron.php and still see this error.
Comment #19
Anonymous (not verified) CreditAttribution: Anonymous commentedAlso, if $node->taxonomy exists and the tids include the tids autotag add then there is no reason to call taxonomy_node_save(). If autotag would add more then those should be added to $node->taxonomy instead of calling taxonomy_node_save(). Thinking further, IMO, $node->taxonomy should always be created and taxonomy_node_save should never be called.
Ah, yes, the weight of the autotag module just needs to come before the weight of the taxonomy module. Then it's hook_nodeapi implementation will take the $node->taxonomy object and pass it to taxonomy_node_save(). The weight of autotag module can be changed in the install/update procedures by modifying the row in the {system} table.
Comment #20
sdrycroft CreditAttribution: sdrycroft commentedThis shouldn't be anything to do with this module, as it has no hook_cron function.
Comment #21
Anonymous (not verified) CreditAttribution: Anonymous commentedNo but feedAPI does and creates updates to existing nodes and inserts for new nodes causing the hook_nodeapi of this module to call taxonomy_node_save with duplicate data in the $terms array.
Comment #22
Anonymous (not verified) CreditAttribution: Anonymous commentedHere's a patch that fixes the issue. This difference is against the 1.17 source.
Comment #23
Anonymous (not verified) CreditAttribution: Anonymous commentedDuh
Comment #24
sdrycroft CreditAttribution: sdrycroft commentedCheers for this earnie. This has inspired me to also fix http://drupal.org/node/291846 , which will be included in 6.x-1.18.
Comment #25
Anonymous (not verified) CreditAttribution: Anonymous commentedI happen to think that I should have checked for is_object and is_array for the type of data in $term similar to what taxonomy_node_save does. Other modules might also badly add taxonomy. I'll create a different issue with a new patch unless you want to just take care of it.
Comment #26
sdrycroft CreditAttribution: sdrycroft commentedThanks earnie, I've adapted your fix a little, although I don't feel that it is necessary to check if $node->taxonomy is_object.
Comment #27
Anonymous (not verified) CreditAttribution: Anonymous commentedI'm still getting duplicates. I see duplicate tids in the $terms[$vid] array. I didn't catch it earlier because my feeds didn't fire due to timing.
The fix I propose is
Comment #28
Anonymous (not verified) CreditAttribution: Anonymous commented@sdrycroft: Your adaptation doesn't resolve the duplicate data in $terms and causes #370221: Object to string conversion error.
Comment #29
sdrycroft CreditAttribution: sdrycroft commentedPlease completely uninstall the previous version of Autotag, and install the latest 6.x-1.19 version. When posting bug reports, please ensure you post a list of all other contributed modules that are installed, and the exact steps required to reproduce the bug you're experiencing from a clean Drupal install.
Comment #31
chrisbuck CreditAttribution: chrisbuck commentedReceiving this error each time I use "Re-autotag by content type": "user warning: Duplicate entry '0-9' for key 1 query: INSERT INTO term_node (nid, vid, tid) VALUES (8, 9, 0) in /home/..../modules/taxonomy/taxonomy.module on line 701."
I'm using version 6x-1.27 and the following taxonomy modules:
Tagging 6.x-2.0-beta2
Tagging extractor suggestions 6.x-2.0-beta2
Tagging opencalais suggestions 6.x-2.0-beta2
Tagging vocabular suggestion 6.x-2.0-beta2
My settings are correct (i.e., "multiple" and "required"). Any help would be appreciated. I'm very interested in this module's development. Thanks.
Comment #32
apadernoI am changing the referring version as per previous comment.
Comment #33
chrisbuck CreditAttribution: chrisbuck commentedThanks. I'm following this thread - because the certain taxonomies aren't working correctly. Just a few. I consistently get this error, and it seems like certain tags are misapplied. For instance, the text string is something like "Dog" and it ends up tagging the node as "Cat."
Comment #34
tobiberlinI also get this error when updating an existing node with tags in it - using Autotag 1.27, Lowername 1.1 and the following Taxonomy related modules:
Simplenews
Simplenews Actions
Simplenews Analytics
Simplenews Statistics
XML sitemap taxonomy
Forum Access
Forum
Taxonomy is latest version 6.16 and the error message mentions now another line:
The vocabulary is "tags" with multiple select - other constellations did not work for me.
Comment #35
tobiberlinas there was no post for longer... does no one has this problem anymore??????
Comment #36
oldmoonlake CreditAttribution: oldmoonlake commentedYes, I am.
user warning: Duplicate entry '0-617' for key 'PRIMARY' query: INSERT INTO term_node (nid, vid, tid) VALUES (617, 617, 0) in /public_html/modules/taxonomy/taxonomy.module on line 701.
Taxonomy related module: Taxonomy hide, Taxonomy Menu, Taxonomy Node, Lowername
Comment #37
fuscata CreditAttribution: fuscata commentedI'm having the problem, perhaps with a slightly older version:
// $Id: taxonomy.module,v 1.414.2.12 2009/09/15 11:13:08 goba Exp $
Anyway, in this code:
It looks to me like the INSERT is performed twice if isset($terms['tags']).
Am I right that changing this line:EDIT: This causes problems when editing taxonomy from the GUI.if (is_array($terms)) {
to:
else if (is_array($terms)) {
fixes the problem?
Comment #38
chrisbuck CreditAttribution: chrisbuck commentedAlso getting the error at line 693 in taxonomy.module. I get this error from the log when trying to update an ipaper content type (note: I do have autotag module set to autotag the ipaper content type):
Is this an issue with the taxonomy module, the autotag module or both?
Comment #39
sdrycroft CreditAttribution: sdrycroft commentedThis issue should be fixed in v2 of the module. Please re-open this issue if you're still experiencing any of the problems above.
Comment #40
ckreutz CreditAttribution: ckreutz commentedI have updated to the v2. But I still get the error.
Particular when I re-autotag, I get dozens of these errors:
Duplicate entry '41938-59316' for key 1 query: INSERT INTO term_node (nid, vid, tid) VALUES (59124, 59316, 41938) in //taxonomy.module in line 709.
Comment #42
rkodrupal CreditAttribution: rkodrupal commentedI set up one content type with only one taxonomy (keywords).
I ran autotag and it successfully updated the keywords tags
I re-ran autotag (as an Autotag on Save with a single node) and got a report log filled with entries similar to the following:
Duplicate entry '375-801' for key 'PRIMARY' query: INSERT INTO term_node (nid, vid, tid) VALUES (755, 801, 375) in C:\xampp\htdocs\modules\taxonomy\taxonomy.module on line 709.
each of the keywords that were already there from the first autotag had a corresponding error in the log report. it looks as though autotag is doing an insert instead of an update?
will make it difficult to update tags to reflect changes to the keywords taxonomy, since legitimate errors will be buried in amongst these illegitimate bastards.
Comment #43
protoplasm CreditAttribution: protoplasm commentedExactly same issue. I am also getting double tags. I am going to have to go back to the old version for now. BTW, I love this module. Keep up the good work.
Comment #44
mkinnan CreditAttribution: mkinnan commentedI receive the same errors when running the re-autotag at /admin/settings/autotag.
If I empty out the term_node table and run the re-autotag, it works great. Running the re-autotag a 2nd time results in the dozens of error messages.
Comment #45
kyen99 CreditAttribution: kyen99 commentedSeems like this is still an issue, although, it doesn't seem to be affecting functionality. subscribe!
Comment #46
tobiberlinsame here:
Comment #47
sdrycroft CreditAttribution: sdrycroft commentedComment #48
deomurari CreditAttribution: deomurari commentedI have the same issue
Duplicate entry '11355-76' for key 'PRIMARY' query: INSERT INTO term_node (nid, vid, tid) VALUES (76, 76, 11355) in D:\xampp\htdocs\avian\modules\taxonomy\taxonomy.module on line 708.
llegal offset type in D:\xampp\htdocs\avian\modules\taxonomy\taxonomy.module on line 1042.
and some warning messages also...
warning: Illegal offset type in isset or empty in D:\xampp\htdocs\avian\modules\taxonomy\taxonomy.module on line 1038.
warning: Illegal offset type in D:\xampp\htdocs\avian\modules\taxonomy\taxonomy.module on line 1039.
warning: Illegal offset type in D:\xampp\htdocs\avian\modules\taxonomy\taxonomy.module on line 1042.
warning: Illegal offset type in isset or empty in D:\xampp\htdocs\avian\modules\taxonomy\taxonomy.module on line 1038.
warning: Illegal offset type in D:\xampp\htdocs\avian\modules\taxonomy\taxonomy.module on line 1039.
warning: Illegal offset type in D:\xampp\htdocs\avian\modules\taxonomy\taxonomy.module on line 1042.
Comment #49
Anonymous (not verified) CreditAttribution: Anonymous commentedThe problem seems to be that the taxonomy is specified twice in the modified node object, once as an already existing database object and once in as an array as I illustrate in #16. This is at least a major issue and certainly not minor.
Comment #50
sdrycroft CreditAttribution: sdrycroft commentedWhy is this major? Does your site crash? Does it stop the node from saving? Has data been lost?
Comment #51
Anonymous (not verified) CreditAttribution: Anonymous commentedPretty much makes your module unusable, yes.
Comment #52
chrisns CreditAttribution: chrisns commentedPlease find attached patch for your consideration for merging (and for those like me that use drush_make in the mean time)
The issue arises when there are multiple fields/form parts that autotags are created from, duplicate tags are marked.
This patch in a very crude fashion, removes those duplicates.
Comment #53
senzaesclusiva CreditAttribution: senzaesclusiva commentedI have applied this patch, but it returns always this warning:
user warning: Duplicate entry '103-522' for key 'PRIMARY' query: INSERT INTO term_node (nid, vid, tid) VALUES (522, 522, 103) in /Applications/MAMP/htdocs/mysite/modules/taxonomy/taxonomy.module on line 716.
user warning: Duplicate entry '103-523' for key 'PRIMARY' query: INSERT INTO term_node (nid, vid, tid) VALUES (523, 523, 103) in /Applications/MAMP/htdocs/mysite/modules/taxonomy/taxonomy.module on line 716.
user warning: Duplicate entry '103-524' for key 'PRIMARY' query: INSERT INTO term_node (nid, vid, tid) VALUES (524, 524, 103) in /Applications/MAMP/htdocs/mysite/modules/taxonomy/taxonomy.module on line 716.
user warning: Duplicate entry '103-567' for key 'PRIMARY' query: INSERT INTO term_node (nid, vid, tid) VALUES (567, 567, 103) in /Applications/MAMP/htdocs/mysite/modules/taxonomy/taxonomy.module on line 716.
Etc........
the site does not crash and the update of the new nodes is still correct.
One request; it's possible to re-autotag ONLY NEW NODES? (infact this error appers because it attempts to update also the old nodes)
PS. I'm not very practical about Drupal API, but IMO may be there is something strange in autotag.module, line 96 ?:
Are you sure that the module should have the same behavior in the two cases?
case-update
case-insert
Best
Comment #54
kenorb CreditAttribution: kenorb commentedComment #55
alvar0hurtad0Closing this issue as seems to be outdate.
Please, re-open in case someone else needs support with it.