PDO exception for Entity Reference Module I have 2 custom content type 'Movie' and 'Director';

In the Movie type there is a field that refers to some Director type.

Now , when i try to create a Movie content type it generates the following error.But the site admin can successfully create Movies.

PDOException: SQLSTATE[23000]: Integrity constraint violation: 1052 Column 'nid' in where clause is ambiguous: SELECT DISTINCT node.nid AS entity_id, node.vid AS revision_id, node.type AS bundle, :entity_type AS entity_type FROM {node} node INNER JOIN {node_access} na ON na.nid = node.nid WHERE (nid IN (:db_condition_placeholder_0)) AND (type IN (:db_condition_placeholder_1)) AND(( (na.gid = :db_condition_placeholder_2) AND (na.realm = :db_condition_placeholder_3) )OR( (na.gid = :db_condition_placeholder_4) AND (na.realm = :db_condition_placeholder_5) ))AND (na.grant_view &gt;= :db_condition_placeholder_6) ; Array ( [:db_condition_placeholder_0] =&gt; 2 [:db_condition_placeholder_1] =&gt; writer [:db_condition_placeholder_2] =&gt; 0 [:db_condition_placeholder_3] =&gt; all [:db_condition_placeholder_4] =&gt; 32 [:db_condition_placeholder_5] =&gt; user_relationship_node_access_author [:db_condition_placeholder_6] =&gt; 1 [:entity_type] =&gt; node ) in EntityFieldQuery-&gt;execute() (line 1136 of /home/mysite/public_html/includes/entity.inc).


I solved the problem .In /public_html/includes/entity.inc I changed 

$this-&gt;addCondition($select_query,$sql_field, $this-&gt;entityConditions['entity_id']);


to   

$this-&gt;addCondition($select_query,"$base_table.".$sql_field, $this-&gt;entityConditions['entity_id']);


this statement should be somewhere near of line 1207
The reason is here:

[…] ON na.nid = node.nid WHERE (nid IN (:db_condition_placeholder_0)) […]


Can you see the nid after the WHERE keyword, it has no identifier and therefore PDO does not know how to handle it. You must prefix it with the correct table name (or assigned shortcut). Either na.nid or node.nid should do the trick.