diff --git a/core/modules/node/node.module b/core/modules/node/node.module index 3db5bbd..8e3e549 100644 --- a/core/modules/node/node.module +++ b/core/modules/node/node.module @@ -3359,11 +3359,23 @@ function _node_query_node_access_alter($query, $type) { // For an entity query, attach the subquery to entity conditions. if ($type == 'entity') { - $node_conditions->exists($subquery); + if ($tableinfo['join type'] == 'LEFT') { + // This table can be null. + $node_conditions->condition(db_or()->isNull("$nalias.$field")->exists($subquery)); + } + else { + $node_conditions->exists($subquery); + } } // Otherwise attach it to the node query itself. else { - $query->exists($subquery); + if ($tableinfo['join type'] == 'LEFT') { + // This table can be null. + $query->condition(db_or()->isNull("$nalias.$field")->exists($subquery)); + } + else { + $query->exists($subquery); + } } } }