--- includes/query.inc.orig	2009-06-02 14:17:06.000000000 -0400
+++ includes/query.inc	2009-09-25 01:52:06.000000000 -0400
@@ -116,7 +116,23 @@ class views_query {
    */
   function set_distinct($value = TRUE) {
     if (!(isset($this->no_distinct) && $value)) {
-      $this->distinct = $value;
+      // Hack in a check to see if node_access is going to add its own
+      // DISTINCT and break this query. See
+      // http://drupal.org/node/284392 for the core bug.
+      // 
+      // We want to bypass views distinct code if this bug will be
+      // triggered. So if the base field is nid and there is a node
+      // access module, bypass views distinct code.
+      //
+      // Since this bug has different implications for Drupal
+      // pre-6.14 and 6.14, we need to include a check for Drupal's
+      // version.
+      if (floatval(VERSION) < 6.14 && $this->base_field == 'nid' && !node_access_view_all_nodes()) {
+        $this->distinct = FALSE;
+      }
+      else {
+        $this->distinct = $value;
+      }
     }
   }
 
@@ -877,6 +893,19 @@ class views_query {
    *   Provide a countquery if this is true, otherwise provide a normal query.
    */
   function query($get_count = FALSE) {
+    // Hack in a check to see if node_access is not going to add its
+    // own DISTINCT and break this query. See
+    // http://drupal.org/node/284392 for the core bug.
+    //
+    // We want to force the DISTINCT value if the base field is nid
+    // and there is a node_access module.
+    //
+    // Since this bug has different implications for Drupal pre-6.14
+    // and 6.14, we need to include a check for Drupal's version.
+    if (floatval(VERSION) >= 6.14 && $this->base_field == 'nid' && !node_access_view_all_nodes()) {
+      $this->distinct = TRUE;
+    }
+
     // Check query distinct value.
     if (empty($this->no_distinct) && $this->distinct && !empty($this->fields)) {
       if (!empty($this->fields[$this->base_field])) {
