Index: includes/common.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/common.inc,v
retrieving revision 1.1056
diff -u -p -r1.1056 common.inc
--- includes/common.inc	3 Dec 2009 02:20:28 -0000	1.1056
+++ includes/common.inc	5 Dec 2009 00:05:55 -0000
@@ -5731,14 +5731,15 @@ function drupal_schema_fields_sql($table
  * Save a record to the database based upon the schema.
  *
  * Default values are filled in for missing items, and 'serial' (auto increment)
- * types are filled in with IDs.
+ * types are filled in with IDs. Values for non-'serial' fields without default 
+ * values defined in the schema must be provided.
  *
  * @param $table
  *   The name of the table; this must exist in schema API.
  * @param $object
  *   The object to write. This is a reference, as defaults according to
  *   the schema may be filled in on the object, as well as ID on the serial
- *   type(s). Both array an object types may be passed.
+ *   type(s). Both array and object types may be passed.
  * @param $primary_keys
  *   If this is an update, specify the primary keys' field names. It is the
  *   caller's responsibility to know if a record for this object already
@@ -5781,8 +5782,13 @@ function drupal_write_record($table, &$o
     }
 
     // For inserts, populate defaults from schema if not already provided.
-    if (!isset($object->$field) && empty($primary_keys) && isset($info['default'])) {
-      $object->$field = $info['default'];
+    if (!isset($object->$field) && empty($primary_keys)) {
+      if (isset($info['default'])) {
+        $object->$field = $info['default'];
+      }
+      elseif ($info['type'] != 'serial') {
+        watchdog('php', 'drupal_write_record: value for %table.%field missing and no default value specified for field.', array('%table' => $table, '%field' => $field), WATCHDOG_ERROR);
+      }
     }
 
     // Track serial field so we can helpfully populate them after the query.
