Index: includes/common.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/common.inc,v
retrieving revision 1.864
diff -u -p -r1.864 common.inc
--- includes/common.inc	5 Feb 2009 01:21:16 -0000	1.864
+++ includes/common.inc	5 Feb 2009 02:39:52 -0000
@@ -3952,7 +3952,9 @@ function drupal_write_record($table, &$o
       $object->$serial = $last_insert_id;
     }
   }
-  else {
+  // If we have a single-field primary key but got no insert ID, the
+  // query failed.
+  elseif (count($primary_keys) == 1) {
     $return = FALSE;
   }
 
