diff --git a/core/modules/node/node.install b/core/modules/node/node.install
index 82fd2e7..a8db56a 100644
--- a/core/modules/node/node.install
+++ b/core/modules/node/node.install
@@ -450,6 +450,7 @@ function node_uninstall() {
   // Delete node type variables.
   $types = db_query('SELECT type FROM {node_type}')->fetchCol();
   foreach ($types as $type) {
+    field_attach_delete_bundle('node', $type);
     db_delete('variable')
       ->condition(db_or()
         ->condition('name', 'node_preview_' . $type)
diff --git a/core/modules/node/node.test b/core/modules/node/node.test
index d018203..083b97c 100644
--- a/core/modules/node/node.test
+++ b/core/modules/node/node.test
@@ -1422,6 +1422,38 @@ class NodeTypeTestCase extends DrupalWebTestCase {
       $this->assertTrue(isset($types[$type]->disabled) && empty($types[$type]->disabled), t('%type type is enabled.', array('%type' => $type)));
     }
   }
+
+  /**
+   * Test uninstall and reinstall of the node module.
+   */
+  function testUninstallReinstall() {
+    // Fields and field instances attached to node types should be
+    // removed when the module is uninstalled.
+    $this->field_name = drupal_strtolower($this->randomName() . '_field_name');
+    $this->field = array('field_name' => $this->field_name, 'type' => 'text', 'cardinality' => 4);
+    $this->field = field_create_field($this->field);
+    $this->instance = array(
+      'field_name' => $this->field_name,
+      'entity_type' => 'node',
+      'bundle' => 'page',
+      'label' => $this->randomName() . '_label',
+    );
+    field_create_instance($this->instance);
+
+    module_disable(array('node'));
+    drupal_flush_all_caches();
+    require_once DRUPAL_ROOT . '/core/includes/install.inc';
+    drupal_uninstall_modules(array('node'));
+    module_enable(array('node'));
+
+    // Now create a node type with the same name. All field instances
+    // connected to this type should have been removed when the module was
+    // uninstalled. Creating a new field with the same name and
+    // an instance of this field on the same type should be successful.
+    unset($this->field['id']);
+    field_create_field($this->field);
+    field_create_instance($this->instance);
+  }
 }
 
 /**
