When used with Organic Groups, file_entity_query_entity_field_access_alter() causes a fatal "column not found" error on certain entity field queries. In particular, this causes major problems with Open Atrium. As best I can tell, this is what's happening:
The query that causes the error starts off as something like:
SELECT field_data_og_group_ref0.entity_type AS entity_type, field_data_og_group_ref0.entity_id AS entity_id ...
FROM {field_data_og_group_ref} field_data_og_group_ref0 ...
_file_entity_query_file_entity_access_alter() does a bunch of stuff, and ultimately adds a field_data_og_group_ref0.entity_id = fm_access.fid
into the WHERE clause of a subquery.
Later, og_query_og_membership_alter() seems to be changing the table name/alias in the outer query to {og_membership} ogm, but the subquery condition stays the same, causing the Column Not Found error.
Comment | File | Size | Author |
---|---|---|---|
#2 | file_entity-query-alter-og-2934180-2.patch | 761 bytes | JeffM2001 |
|
Comments
Comment #2
JeffM2001 CreditAttribution: JeffM2001 commentedHere's a patch that prevents file_entity from altering queries that will lead to the error.
Comment #3
joseph.olstadShould we act quickly on this and cut a new release of file_entity with this patch?
any objections?
Plan:
cut a new release with this patch... 2.13
timeline? less than 1 week to review from this date.
Comment #4
joseph.olstadComment #5
joseph.olstadsee #2934201: Plan for file_entity release 7.x-2.14
Comment #6
joseph.olstadThis affects versions of file_entity between and including 2.0 and 2.12
If you have this issue either apply this patch OR (most likely because using organic groups), upgrade to 2.13 which will be released approximately in one or two days, expect by January 7th 2018
Comment #7
joseph.olstadCommitted this patch as-is.
fixed in release 7.x-2.14
https://www.drupal.org/files/issues/file_entity-query-alter-og-2934180-2...
Comment #11
joseph.olstadAlthough appears benign
Now that #2067671: Ensure file query alteration is performed when using EntityFieldQuery
is reverted for 2.16
this commit / patch is no longer needed so review whether or not to remove this.
Comment #12
joseph.olstadShould probably revert this above commit