Index: content.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/cck/content.module,v
retrieving revision 1.56.2.17
diff -u -r1.56.2.17 content.module
--- content.module	21 Aug 2006 03:06:45 -0000	1.56.2.17
+++ content.module	2 Oct 2006 16:34:54 -0000
@@ -389,7 +389,13 @@
         $column_assignments = array();
         foreach ($db_info['columns'] as $column => $attributes) {
           $column_names[] = $attributes['column'];
-          switch ($attributes['type']) {
+          if ($item[$column] == '' && !$attributes['not null'] && !$field['required']) {
+            $column_placeholders[] = '%s';
+            $column_assignments[] = $attributes['column'] .' = %s';
+            $item[$column] = 'NULL';
+          }
+          else {
+           switch ($attributes['type']) {
             case 'int':
             case 'mediumint':
             case 'tinyint':
@@ -404,6 +410,7 @@
             default:
               $column_placeholders[] = "'%s'";
               $column_assignments[] = $attributes['column'] ." = '%s'";
+           }
           }
           $data[] = $item[$column];
         }
@@ -440,7 +447,14 @@
         $column_assignments = array();
         foreach ($db_info['columns'] as $column => $attributes) {
           $column_names[] = $attributes['column'];
-          switch ($attributes['type']) {
+          $column_names[] = $attributes['column'];
+          if ($item[$column] == '' && !$attributes['not null'] && !$field['required']) {
+            $column_placeholders[] = '%s';
+            $column_assignments[] = $attributes['column'] .' = %s';
+            $item[$column] = 'NULL';
+          }
+          else {
+            switch ($attributes['type']) {
             case 'int':
             case 'mediumint':
             case 'tinyint':
@@ -455,6 +469,7 @@
             default:
               $column_placeholders[] = "'%s'";
               $column_assignments[] = $attributes['column'] ." = '%s'";
+            }
           }
           $data[] = $item[$column];
         }
