When a node is created and connected with multiple terms, then the node and the terms are connected in table "term_node" in the database.

But when a node is later edited and one or more of the terms are disconnected from the node, those changes are not recorded in "node_terms" in the database, not even after submitting the changes. Which actually means that the change is not recorded, and the next time a user accesses the node, the node will still be connected with those terms that the user was editing the node to disconnect the node from.

So now one has to manually remove the 'node - term connection' in the database, or just live with the bug that terms cannot be disconnected from nodes, or vice versa, once they are mode.

Best
Lennart

Comments

Anonymous’s picture

So now one has to manually remove the 'node - term connection' in the database, or just live with the bug that terms cannot be disconnected from nodes, or vice versa, once they are mode.

The problem is not so simple...

When the term of some node is changed more than once and than changed back to one of previously selected terms during later editation you will get following error message after sending form (because newly generated PRIMARY key is already in the term-node table):

user error: Duplicate entry '3-1' for key 1
query: INSERT INTO term_node (nid, tid) VALUES (1, 3) in /mnt/lv0-home/.../drupal-cvs/includes/database.mysql.inc on line 66.

warning: Cannot modify header information - headers already sent by (output started at /mnt/lv0-home/www/...

Ladislav

Anonymous’s picture

So now one has to manually remove the 'node - term connection' in the database, or just live with the bug that terms cannot be disconnected from nodes, or vice versa, once they are mode.

The problem is not so simple...

When the term of some node is changed more than once and than changed back to one of previously selected terms during later editation you will get following error message after sending form (because newly generated PRIMARY key is already in the term-node table):

user error: Duplicate entry '3-1' for key 1
query: INSERT INTO term_node (nid, tid) VALUES (1, 3) in /mnt/lv0-home/.../drupal-cvs/includes/database.mysql.inc on line 66.

warning: Cannot modify header information - headers already sent by (output started at /mnt/lv0-home/www/...

Ladislav

Anonymous’s picture

Priority: Normal » Critical

So now one has to manually remove the 'node - term connection' in the database, or just live with the bug that terms cannot be disconnected from nodes, or vice versa, once they are mode.

The problem is not so simple...

When the term of some node is changed more than once and than changed back to one of previously selected terms during later editation you will get following error message after sending form (because newly generated PRIMARY key is already in the term-node table):

user error: Duplicate entry '3-1' for key 1
query: INSERT INTO term_node (nid, tid) VALUES (1, 3) in /mnt/lv0-home/.../drupal-cvs/includes/database.mysql.inc on line 66.

warning: Cannot modify header information - headers already sent by (output started at /mnt/lv0-home/www/...

Ladislav

Anonymous’s picture

So now one has to manually remove the 'node - term connection' in the database, or just live with the bug that terms cannot be disconnected from nodes, or vice versa, once they are mode.

The problem is not so simple...

When the term of some node is changed more than once and than changed back to one of previously selected terms during later editation you will get following error message after sending form (because newly generated PRIMARY key is already in the term-node table):

user error: Duplicate entry '3-1' for key 1
query: INSERT INTO term_node (nid, tid) VALUES (1, 3) in /mnt/lv0-home/.../drupal-cvs/includes/database.mysql.inc on line 66.

warning: Cannot modify header information - headers already sent by (output started at /mnt/lv0-home/www/...

Ladislav

Anonymous’s picture

So now one has to manually remove the 'node - term connection' in the database, or just live with the bug that terms cannot be disconnected from nodes, or vice versa, once they are mode.

The problem is not so simple...

When the term of some node is changed more than once and than changed back to one of previously selected terms during later editation you will get following error message after sending form (because newly generated PRIMARY key is already in the term-node table):

user error: Duplicate entry '3-1' for key 1
query: INSERT INTO term_node (nid, tid) VALUES (1, 3) in /mnt/lv0-home/.../drupal-cvs/includes/database.mysql.inc on line 66.

warning: Cannot modify header information - headers already sent by (output started at /mnt/lv0-home/www/...

Ladislav

mousse-man’s picture

Isn't the solution to use some DB trigger to change that, So everytime you update a node, you also execute an UPDATE trigger on term_node automatically? This would save quite some PHP code and transfer the 'effort' to SQL.

And yes, MySQL 4 can do triggers, don't know about Version 3.23. And of course PostgreSQL and Oracle can do it as well.

mousse-man’s picture

Something like

create function del_node_term_node (integer) RETURNS integer AS '
	BEGIN
		delete $1 from term_node;
	END
' LANGUAGE 'plpgsql';

should do the trick.

This way, we can run the function from PHP.

jvandyk’s picture

Status: Active » Closed (fixed)

I can't reproduce this. In fact, I can't even understand what's being said.

This seems to imply that there is a problem with terms being lost from term_node. Testing with HEAD shows there is no problem.

I don't know of a "node_terms" table.

Closing.