Index: includes/database/schema.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/database/schema.inc,v
retrieving revision 1.32
diff -u -p -r1.32 schema.inc
--- includes/database/schema.inc	21 Mar 2010 20:49:01 -0000	1.32
+++ includes/database/schema.inc	22 Mar 2010 05:13:45 -0000
@@ -554,12 +554,22 @@ abstract class DatabaseSchema implements
    *   If the specified table already exists.
    */
   public function createTable($name, $table) {
-    if ($this->tableExists($name)) {
-      throw new DatabaseSchemaObjectExistsException(t('Table %name already exists.', array('%name' => $name)));
+    try {
+      $statements = $this->createTableSql($name, $table);
+      foreach ($statements as $statement) {
+        $this->connection->query($statement);
+      }
     }
-  	$statements = $this->createTableSql($name, $table);
-    foreach ($statements as $statement) {
-    	$this->connection->query($statement);
+    catch (PDOException $e) {
+      // Detect cases where the table could not be created because it already
+      // exists. We do this here, rather than calling tableExists() up front,
+      // because tableExists() can be slow.
+      if ($e->getCode() == '42S01') {
+        throw new DatabaseSchemaObjectExistsException(t('Table %name already exists.', array('%name' => $name)));
+      }
+      else {
+        throw $e;
+      }
     }
   }
 
