As reported in #1412642: Malformed sql query with domain access / node_access, certain entity field queries can result in ambiguous conditions being added. My specific example is using the Entity Reference module along with Domain Access. When saving a node, Entity Field Reference validates the entities refered to, and the query is altered by Domain Access. This involves a JOIN where the joined-in table has a column called 'nid'. However, EntityFieldQuery::propertyQuery adds a condition called 'nid', which is ambiguous. This means that any node access module which joins in a table with a column called 'nid' might encounter issues.
The fix is to provide the base table name as part of the field name in the condition, as per the attached patch.
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | drupal_ambiguous_entity_query_1627270.patch | 1.07 KB | Rob Knight |
Comments
Comment #1
Rob Knight commentedPatch attached.
Comment #2
becw commentedI ran into this issue too, and this fix works for me.
Comment #3
David_Rothstein commentedLooks to me like the same issue as #1325628: EntityFieldQuery::propertyQuery missing fully qualified column names causes ambiguous column DB error, which already had a fix for this committed.