Index: node.module
===================================================================
--- node.module	(.../vendor/drupal/6.15/modules/node/node.module)	(revision 533)
+++ node.module	(.../trunk/siteroot/modules/node/node.module)	(revision 533)
@@ -2059,26 +2059,6 @@
 }
 
 /**
- * Generate an SQL join clause for use in fetching a node listing.
- *
- * @param $node_alias
- *   If the node table has been given an SQL alias other than the default
- *   "n", that must be passed here.
- * @param $node_access_alias
- *   If the node_access table has been given an SQL alias other than the default
- *   "na", that must be passed here.
- * @return
- *   An SQL join clause.
- */
-function _node_access_join_sql($node_alias = 'n', $node_access_alias = 'na') {
-  if (user_access('administer nodes')) {
-    return '';
-  }
-
-  return 'INNER JOIN {node_access} '. $node_access_alias .' ON '. $node_access_alias .'.nid = '. $node_alias .'.nid';
-}
-
-/**
  * Generate an SQL where clause for use in fetching a node listing.
  *
  * @param $op
@@ -2170,9 +2150,11 @@
  */
 function node_db_rewrite_sql($query, $primary_table, $primary_field) {
   if ($primary_field == 'nid' && !node_access_view_all_nodes()) {
-    $return['join'] = _node_access_join_sql($primary_table);
-    $return['where'] = _node_access_where_sql();
-    $return['distinct'] = 1;
+    $wsql = _node_access_where_sql();
+    if ($wsql) {
+      $return['where'] = '((SELECT COUNT(*) FROM node_access na WHERE '.$primary_table.
+      '.nid = na.nid AND ('. $wsql .')) > 0)';
+    }
     return $return;
   }
 }
