Closed (won't fix)
Project:
Drupal core
Version:
7.x-dev
Component:
taxonomy.module
Priority:
Normal
Category:
Bug report
Assigned:
Reporter:
Created:
18 May 2009 at 18:48 UTC
Updated:
19 May 2009 at 17:44 UTC
When a node with term objects but empty tid's is saved, the following exception is thrown:
PDOException: INSERT INTO {taxonomy_term_node} (nid, vid, tid) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2) - Array ( [:db_insert_placeholder_0] => 3881 [:db_insert_placeholder_1] => 3881 [:db_insert_placeholder_2] => ) SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'tid' cannot be null in taxonomy_node_save() (line 844 of /home/sascha/Projekte/d7/drupal/modules/taxonomy/taxonomy.module).
This happens for example when devel_generate is used to generate new nodes.
The attached patch fixes this but we probably need a test for this...
| Comment | File | Size | Author |
|---|---|---|---|
| taxonomy_node_save.patch | 876 bytes | berdir |
Comments
Comment #1
dries commentedIsn't that a bug in the calling code?
Comment #2
berdirOk, after talking with chx and moshe, the difference to D6 is that %d casted the NULL value to 0 and it inserted dummy values, while :tid tries to insert NULL and that doesn't work.
Imho, there is no reason to pass in $term objects without a tid, so I opened a bug report for devel_generate (#467214: devel_generate should not use $term objects with empty tid when creating nodes.)