Index: modules/node/node.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/node/node.module,v
retrieving revision 1.1102
diff -u -p -r1.1102 node.module
--- modules/node/node.module	20 Aug 2009 09:47:04 -0000	1.1102
+++ modules/node/node.module	20 Aug 2009 20:21:53 -0000
@@ -2287,7 +2287,7 @@ function node_search_validate($form, &$f
  *   Optional, a user object representing the user for whom the operation is to
  *   be performed. Determines access for a user other than the current user.
  * @return
- *   TRUE if the operation may be performed.
+ *   TRUE if the operation may be performed, FALSE otherwise.
  */
 function node_access($op, $node, $account = NULL) {
   global $user;
@@ -2336,13 +2336,14 @@ function node_access($op, $node, $accoun
   // node_access table.
   if ($op != 'create' && $node->nid) {
     $query = db_select('node_access');
-    $query->addExpression('COUNT(*)');
+    $query->addExpression('1');
     $query->condition('grant_' . $op, 1, '>=');
     $nids = db_or()->condition('nid', $node->nid);
     if ($node->status) {
       $nids->condition('nid', 0);
     }
     $query->condition($nids);
+    $query->range(0, 1);
 
     $grants = db_or();
     foreach (node_access_grants($op, $account) as $realm => $gids) {
@@ -2353,10 +2354,10 @@ function node_access($op, $node, $accoun
         );
       }
     }
-    if (count($grants) > 0 ) {
+    if (count($grants) > 0) {
       $query->condition($grants);
     }
-    return $query
+    return (bool) $query
       ->execute()
       ->fetchField();
   }
