Index: includes/common.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/common.inc,v
retrieving revision 1.716
diff -u -F^f -r1.716 common.inc
--- includes/common.inc	20 Nov 2007 10:18:42 -0000	1.716
+++ includes/common.inc	20 Nov 2007 21:24:51 -0000
@@ -3228,8 +3228,10 @@ 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.
+ * Default values are filled in for missing fields, and 'serial' (auto
+ * increment) fields 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.
@@ -3277,8 +3279,12 @@ function drupal_write_record($table, &$o
     }
 
     // For inserts, populate defaults from Schema if not already provided
-    if (!isset($object->$field)  && !count($update) && isset($info['default'])) {
-      $object->$field = $info['default'];
+    if (!isset($object->$field)  && !count($update)) {
+      if (isset($info['default'])) {
+        $object->$field = $info['default'];
+      } else if ($info['type'] != 'serial') {
+        trigger_error(t('drupal_write_record: mandatory value for %table.%field missing', array('%table' => $table, '%field' => $field)), E_USER_WARNING);
+      }
     }
 
     // Track serial fields so we can helpfully populate them after the query.
