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.

Comments

Rob Knight’s picture

Status: Active » Needs review
StatusFileSize
new1.07 KB

Patch attached.

becw’s picture

Status: Needs review » Reviewed & tested by the community

I ran into this issue too, and this fix works for me.

David_Rothstein’s picture

Status: Reviewed & tested by the community » Closed (duplicate)

Looks 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.