Index: includes/install.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/install.inc,v
retrieving revision 1.152
diff -u -p -r1.152 install.inc
--- includes/install.inc	2 Jan 2011 17:23:20 -0000	1.152
+++ includes/install.inc	2 Feb 2011 14:14:23 -0000
@@ -298,6 +298,20 @@ abstract class DatabaseTasks {
       'arguments'   => array(),
     ),
     array(
+      // The {drupal_install_test} table may exist from a previous failed
+      // installation attempt. Running this task first allows the other tasks
+      // to proceed and guarantees that we will always run at least one test
+      // for both DROP and CREATE.
+      'function'    => 'runTestQueryIfTableExists',
+      'arguments'   => array(
+        'drupal_install_test',
+        'DROP TABLE {drupal_install_test}',
+        'Drupal can use DROP TABLE database commands.',
+        'Failed to <strong>DROP</strong> a test table from your database server. We tried dropping a table with the command %query and the server reported the following error %error.',
+        TRUE,
+      ),
+    ),
+    array(
       'arguments'   => array(
         'CREATE TABLE {drupal_install_test} (id int NULL)',
         'Drupal can use CREATE TABLE database commands.',
@@ -453,6 +467,32 @@ abstract class DatabaseTasks {
   }
 
   /**
+   * Run a test query only if a specified database table exists.
+   *
+   * @param $table
+   *   The database table to check.
+   * @param $query
+   *   Passed as an argument to runTestQuery() when the database table exists.
+   * @param $pass
+   *   Passed as an argument to runTestQuery() when the database table exists.
+   * @param $fail
+   *   Passed as an argument to runTestQuery() when the database table exists.
+   * @param $fatal
+   *   (optional) Passed as an argument to runTestQuery() when the database
+   *   table exists. Defaults to FALSE.
+   *
+   * @return
+   *   NULL if the query ran successfully or did not need to run, TRUE for a
+   *   non-fatal failure while running the query, and FALSE for a fatal
+   *   failure.
+   */
+  protected function runTestQueryIfTableExists($table, $query, $pass, $fail, $fatal = FALSE) {
+    if (db_table_exists($table)) {
+      return $this->runTestQuery($query, $pass, $fail, $fatal);
+    }
+  }
+
+  /**
    * Check the engine version.
    */
   protected function checkEngineVersion() {
