I created a field collection and added it to a content type. After saving content with data in the field collection, I get the following error:
PDOException: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'uuid' in 'field list': INSERT INTO {field_collection_item} (revision_id, field_name, archived, uuid) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3); Array ( [:db_insert_placeholder_0] => 0 [:db_insert_placeholder_1] => field_finishes [:db_insert_placeholder_2] => 0 [:db_insert_placeholder_3] => e114057b-3912-4faf-b996-a5bc03f7ccd3 ) in drupal_write_record() (line 7106 of /var/www/html/drupal-7.20/includes/common.inc).
I have run update.php and cleared caches.
Comments
Comment #1
acouch commentedI think this happens because some entities don't have uuids associated with them. I got a similar error with organic groups. I'm posting it here in case anyone else has the same issue:
In this case og_membership does not have a uuid. I don't know enough about this module to know if that is a bug that should be addressed elsewhere. However the attached patch keeps the module from looking up a uuid on an entity if it doesn't have a uuid key.
Comment #2
btopro commentedwas just able to throw this when doing a restws call for nodes in json format.
was thrown in its place. Looks identical to the issue in #1
EDIT: And the patch supplied in issue 1 resolved this for me as well. This seems like a more sensible approach to verifying that a uuid is set
Comment #3
fagoI ran into this as well. When field collection got installed (after UUID) it did not create the UUID column, while UUID alters in the column later on. This results in the above error when drupal_write_record() fails to write to the not existing UUID column.
I guess UUID module would have to detect when field collection is enabled and adjust is schema after installation.
As interim fix I used an update function like the following:
Comment #4
fagoComment #5
el7cosmosGot error with message entity which didn't have uuid entity keys
Comment #6
chertzog#1 works for me with OG.
Comment #7
jsacksick commentedI also experienced issues (doesn't seem to be the same message though), See http://cl.ly/image/2z0X2W163o2n, The attached patch fixes the issue. I also think the uuid module should implement the
hook_flush_caches()to create the missing table columns... Attaching two patches.Comment #8
Paul B commentedI get the same error with the RESTful Web Services module.
The module does this in getResourceReference:
The patch doesn't help. Maybe entity_get_uuid_by_id() should check if $info['entity keys']['uuid'] actually exists.
Comment #9
btopro commentedThis is not specific to field collections. Patch is a combination of the original proposed solution, the patch in #8 uuid-fix-field-collection-1927474-7.patch and an additional location that this needed to be accounted for in order to work for me. I have this working in production as it was failing on a restWS calls when utilizing organic groups because the group membership entity lacks uuid's as well (I think). This is an obscure but important issue to resolve, especially when dealing with more complex entity driven sites.
Comment #10
nbouhid commentedPatch from #9 doesn't apply cleanly on version: 7.x-1.0-alpha4.
This patch should do the trick.
Have anyone tested this issue on the 7.x-1.0-alpha5 version?
Comment #13
Kazanir commentedRerolled the patch in #9 to correctly check for the enabling of UUID on the entity info as well as the actual presence of the appropriate entity info key.
Comment #14
tomdavidson commentedconfrim #13 worked for me and node_export
Comment #15
btopro commenteddidnt test #13 but looks like it builds on the fixes in #9. bumping to needs review
Comment #16
skwashd commentedThanks everyone for your work on this issue, but it is a duplicate of #2356305: Some contrib entities has no support for UUID, let's skip them., which is currently RTBC. Let's run with that one.