Clean install Drupal 6.1, php 5.2.2, MySQL 4.1.22.
I'm getting this warning when updating content created after installing the module.
user warning: Duplicate entry '4' for key 1 query: INSERT INTO node_lnid SET nid = 4, lnid = 2 in /home/cl0udy/www/swings/modules/type_local_nids/type_local_nids.module on line 44.
Seems like if(!$node->lnid) [line 65] is always returning true so _type_local_nids_generate_lnid is always called when a node is updated.
Altering _node_form to include the type_local_nid fixed the issue for me. Patch attached does this.
| Comment | File | Size | Author |
|---|---|---|---|
| type_local_nids_update_error.patch | 880 bytes | CloudCuckoo |
Comments
Comment #1
jbrown commentedThanks for reporting this. I hadn't tested the 6.x version as much as the 5.x. It's now fixed in 6.x-1.2.
I just needed to ensure that the lnid is loaded during 'update', as it seems D6 does load the node before updating it.
Comment #2
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.
Comment #3
asmdec commentedWhenever the 'insert' operation is called the $node->lnid is false, causing the _type_local_nids_generate_lnid function call, that's not the expected behaviour. I change one line of code to load the 'lnid' property before 'insert' and 'update'.
Comment #4
jbrown commentedNode insertion is the time when _type_local_nids_generate_lnid() should most definitely be called. Thats the whole point of the module.
There is no point in checking if a node has a lnid when it is being created as there is no way it could have one yet.
Comment #5
jbrown commentedSeems some modules (I'm looking at you og_subgroups) call node_load during hook_nodeapi() with $op = 'insert'.
http://drupal.org/cvs?commit=266288