Hello,
I am using this module to link a node to another in an ecommerce site (for a "related products" feature, with drupal commerce). My site also uses domain access to restrict visibility of products following the current domain.
The problem i have : when i save a node with a entity reference field I have the following error :
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) )OR( (na.gid = :db_condition_placeholder_6) AND (na.realm = :db_condition_placeholder_7) ))AND (na.grant_view >= :db_condition_placeholder_8) ORDER BY node.type ASC; Array ( [:db_condition_placeholder_0] => 1328 [:db_condition_placeholder_1] => afficheur_produit_b2c [:db_condition_placeholder_2] => 0 [:db_condition_placeholder_3] => all [:db_condition_placeholder_4] => 0 [:db_condition_placeholder_5] => domain_site [:db_condition_placeholder_6] => 1 [:db_condition_placeholder_7] => domain_id [:db_condition_placeholder_8] => 1 [:entity_type] => node ) dans EntityFieldQuery->execute() (ligne 1136 dans .../includes/entity.inc).
WHERE (nid IN (:db_condition_placeholder_0)) AND (type IN (:db_condition_placeholder_1))
-> nid column name is ambiguous.
If I save the node without selecting any value in the entity reference field, the node gets saved without problem.
I am not sure where the code generates this WHERE constraint and why it is not prefixed with the table alias... any help would be appreciated !
Pascal
Comments
Comment #1
liupascal commentedOk it looks like this issue is related to domain access rather than entity reference.
I disabled a domain setting (do not enforce visibility constraint to administrator) and it's working fine now. I'll post an issue on domain access.
Comment #2
Rob Knight commentedThis issue is actually due to a core bug, there's a patch here: #1627270: propertyQuery can add ambiguous conditions when certain node access modules are used