Index: serial.inc
===================================================================
--- serial.inc
+++ serial.inc
@@ -44,13 +44,15 @@
  *   a new node type machine name
  */
 function _serial_rename_tables($old_type_name, $new_type_name) {
-  $sql = "SELECT f.field_name FROM {content_node_field} f, {content_node_field_instance} i ".
-         "WHERE f.field_name = i.field_name AND f.type = 'serial' AND i.type_name = '%s'";
-  $result = db_query(db_rewrite_sql($sql), $new_type_name);
-  while ($data = db_fetch_object($result)) {
-    $old_table = _serial_get_table_name($old_type_name, $data->field_name);
-    $new_table = _serial_get_table_name($new_type_name, $data->field_name);
-    db_rename_table($ret, $old_table, $new_table);
+  if ($old_type_name && $new_type_name) {
+    $sql = "SELECT f.field_name FROM {content_node_field} AS f, {content_node_field_instance} AS i 
+            WHERE f.field_name = i.field_name AND f.type = 'serial' AND i.type_name = '%s'";
+    $result = db_query($sql, $new_type_name);
+    while ($data = db_fetch_object($result)) {
+      $old_table = _serial_get_table_name($old_type_name, $data->field_name);
+      $new_table = _serial_get_table_name($new_type_name, $data->field_name);
+      db_rename_table($ret, $old_table, $new_table);
+    }
   }
 }
 
@@ -173,3 +175,26 @@
   // Return the number of existing nodes that have been initialized:
   return $count;
 }
+
+/**
+ * Modifies the field definition of the serial field
+ * to have a new starting base value.
+ *
+ * NOTE: This currently only works for MySQL databases.
+ *
+ * @param array $field
+ * The CCK Field definition.
+ *
+ * @param integer $value
+ * The value to start generating IDs from.
+ */
+function _serial_reset_serial_base($field, $value) {
+  global $db_type;
+  if ($db_type == 'mysqli' || $db_type == 'mysql') {
+    // _serial_get_field_table_name($field) wasn't working,
+    // but only here for some reason...
+    $table = 'serial_' . $field['type_name']. '_' . $field['field_name'];
+    $sql = "ALTER TABLE {$table} AUTO_INCREMENT = %d";
+    db_query($sql, $value);
+  }
+}
Index: serial.module
===================================================================
--- serial.module
+++ serial.module
@@ -65,32 +65,9 @@
 function serial_form_alter(&$form, $form_state, $form_id) {
   if ($form_id == 'content_field_edit_form' && $form['#field']['type'] == 'serial') {
     // Hide irrelevant settings:
-    unset($form['widget']);
+    //unset($form['widget']);
     unset($form['field']);
-
-    // After creation of a new field:
-    if (preg_match('#^.*destination.*\=(.*)$#', $form['#action'], $matches)) {
-      // Set serial values for old objects
-      module_load_include('inc', 'serial');
-      $field = $form['#field'];
-      $old_count = _serial_init_old_nodes($field);
-        // (field is not ready yet at serial_content_fieldapi's 'create instance')
-
-      // Show messages:
-      drupal_set_message(
-        t('Serial field %field has been created.',
-          array('%field' => $field['field_name']))
-      );
-      if ($old_count) {
-        drupal_set_message(
-          t('Serial values have been automatically set for %count existing nodes.',
-            array('%count' => $old_count))
-        );
-      }
-
-      // Go back to Managed Fields:
-      drupal_goto(urldecode($matches[1]));
-    }
+    $form['#submit'][] = 'serial_field_form_submit';
   }
 }
 
@@ -212,4 +189,92 @@
       '#default_value' => $items[$delta]['value'],
     )
   );
-}
\ No newline at end of file
+}
+
+/**
+ * Implementation of hook_widget_settings()
+ */
+function serial_widget_settings(&$op, $widget) {
+  // Only allow setting the auto_increment start value for MySQL DBs.
+  global $db_type;
+  if ($db_type != 'mysqli' && $db_type != 'mysql') {
+    return;
+  }
+
+  switch ($op) {
+    case 'form':
+      if (empty($widget['startingvalue'])) {
+        $form['startingvalue'] = array(
+          '#type' => 'textfield',
+          '#title' => t('Starting value'),
+          '#description' => t('Defines the value that teh serial field will start incrementing from.  NOTE: This setting cannot be changed after the field has been created.'),
+          '#default_value' => !empty($widget['startingvalue']) ? $widget['startingvalue'] : 1,
+          '#defualt' => 1,
+          '#required' => TRUE,
+        );
+      }
+      else {
+        // Disable the starting value setting when editing an existing CCK field
+        // Since we cannot change this setting after the field has been created.
+        $form['startingvalue'] = array(
+          '#type' => 'value',
+          '#value' => $widget['startingvalue'],
+        );
+        $form['startingvalue_display'] = array(
+          '#type' => 'textfield',
+          '#title' => t('Starting value'),
+          '#description' => t('Defines the value that teh serial field will start incrementing from.  NOTE: This setting cannot be changed after the field has been created.'),
+          '#default_value' => $widget['startingvalue'],
+          '#defualt' => 1,
+          '#required' => FALSE,
+          '#disabled' => TRUE,
+        );
+      }
+      return $form;
+    case 'validate':
+      if (!is_numeric($widget['startingvalue']) || $widget['startingvalue'] < 0) {
+        form_set_error('startingvalue', t('You have entered an illegal value for the starting value. This value needs to be 0 or greater.'));
+      }
+      break;
+    case 'save':
+      return array('startingvalue');
+  }
+}
+
+/**
+ * Submit handler for the settings form.
+ *
+ * Performs additional processing on field creation
+ * to assign ids to existing content.
+ */
+function serial_field_form_submit($form, &$form_state) {
+  // After creation of a new field:
+  if (preg_match('#^.*destination.*\=(.*)$#', $form['#action'], $matches)) {
+    module_load_include('inc', 'serial');
+    $field = $form['#field'];
+
+    // See if we need to change the base for the serial field before generating content.
+    if (array_key_exists('startingvalue', $form_state['values'])) {
+      $startingvalue = !empty($form_state['values']['startingvalue']) ? $form_state['values']['startingvalue'] : 1;
+      if ($startingvalue > 1) {
+        _serial_reset_serial_base($field, $startingvalue);
+      }
+    }
+
+    // Set serial values for old objects
+    $old_count = _serial_init_old_nodes($field);
+    // (field is not ready yet at serial_content_fieldapi's 'create instance')
+
+    // Show messages:
+    drupal_set_message(
+      t('Serial field %field has been created.',
+        array('%field' => $field['field_name']))
+    );
+    if ($old_count) {
+      drupal_set_message(
+        t('Serial values have been automatically set for %count existing nodes.',
+          array('%count' => $old_count))
+      );
+    }
+  }
+}
