I have 2 vocabularies category (vid =1) and location (vid=2) and several terms under each vocabulary. I create a node and associate one term from each vocabulary with the node. In the term_node table, the nid (Node Id) and the tid (Term Id) are populated correctly. But the vid (Vocab Id) is populated with nid instead of the the vid.

A sample case, node id 10, has two terms with tids 4 and 11 associated with it. The table term_node should look like

[Column] nid, vid, tid
[Row 1] 10, 1, 4
[Row 2] 10, 2, 11

Instead it looks like

[Column] nid, vid, tid
[Row 1] 10, 10, 4
[Row 2] 10, 10, 11

Also, in the term_node table, the primary key is vid and tid. This means that two different nodes cannot have the same terms associated with them. Shouldn't the primary key be nid, vid AND tid?

Comments

Anonymous’s picture

vid is the revision (node_revisions) of the nid (node) and not the vocabulary id (vid in term_data).

gábor hojtsy’s picture

Category: bug » support
Priority: Critical » Normal
Status: Active » Closed (fixed)

As said in #1, the node vid is the revision identifier, not the vocabulary id. This is not an issue. The primary key is vid and tid, since nodes can have different terms associated in their different versions. This is an unfortunate places where the two vid (vocabulary id and node revision id) meet, but there is no bug here.