By W.M. on
I am not sure if this is the way Drupal 7 works, I need to verify:
I have noticed that upon assigning a taxonomy term to a node, duplicate data (two similar rows) get added to taxonomy_index table.
This is what I see inside the table using phpmyadmin:
nid tid sticky
Edit 2 1 0 1310719325
Edit 2 1 0 1310719325
Is this the way it should be ?!
Comments
Same issue here
I see the same problem with a Drupal 6 site that I am updating to D7.
The old nodes are correct, but as soon as I modify them I see the taxonomy fields being duplicated.
I am using D7.4, as there are multilang issues with D7.7. I cannot confirm that this is also occurring in the latest version.
-Patrick
Duplicate items in taxonomy_index
Yes, I have the same problem - duplicate items in table "taxonomy_index", and this causes the duplicate items in Views (f.e. "related posts").
http://imageshack.us/photo/my-images/829/moodleszskmczphpmyadmin.png/
Drupal 7.7, multilanguage
db_add_primary_key('taxonomy_
You should remove all duplicate lines and do in php:
db_add_primary_key('taxonomy_index', array('nid', 'tid'));
or SQL
ALTER IGNORE TABLE taxonomy_index ADD PRIMARY KEY (nid, tid);
But it looks like this is a
But it looks like this is a Drupal 7 core issue, any commits planned for future stable release ?!
http://drupal.org/node/610076
http://drupal.org/node/610076
You should check the presence of this bug:
SELECT COUNT(DISTINCT (CONCAT(tid,nid))) dist,COUNT(*) total FROM taxonomy_index
If dist = total {
ALTER IGNORE TABLE taxonomy_index ADD PRIMARY KEY (nid, tid);
}
else {
execute all 5 SQL queries above
}
I added a primary key, and
I added a primary key, and began to edit my material.
Some fields have been changed.
I'm trying to save the material and see:
PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '52-101' for key 'PRIMARY': INSERT INTO {taxonomy_index} (nid, tid, sticky, created) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3); Array ( [:db_insert_placeholder_0] => 52 [:db_insert_placeholder_1] => 101 [:db_insert_placeholder_2] => 0 [:db_insert_placeholder_3] => 1316360296 ) in function taxonomy_field_update() (string 1730 in file /.../modules/taxonomy/taxonomy.module).
Please help to fix this bug
Duplicates are caused by #1050466: The taxonomy index should be maintained in a node hook, not a field hook