Index: wp-admin/includes/upgrade.php
===================================================================
--- wp-admin/includes/upgrade.php	(revision 22313)
+++ wp-admin/includes/upgrade.php	(working copy)
@@ -1450,6 +1450,25 @@
 }
 
 /**
+ * Unify index line, to perform unique cross-matches
+ *
+ * Remove extra whitespaces, replace 'INDEX' for 'KEY'.
+ *
+ * @param string $input Index options line
+ *
+ * @return string Unified index options line
+ */
+function dbDelta_unifyIndexLine( $input ) {
+	$input = trim( $input );
+	$input = trim( $input, ", \n" );
+	$input = preg_replace( '#\s+#',                   ' ',     $input );
+	$input = preg_replace( '#\s+\(\s*(\d+)\s*\)#',    '(\1)',  $input );
+	$input = preg_replace( '#([^\s])\s*,\s*([^\s])#', '\1,\2', $input );
+	$input = preg_replace( '#^INDEX\s+#',             'KEY ',  $input );
+	return $input;
+}
+
+/**
  * {@internal Missing Short Description}}
  *
  * {@internal Missing Long Description}}
@@ -1536,7 +1555,7 @@
 			case 'unique':
 			case 'key':
 				$validfield = false;
-				$indices[] = trim(trim($fld), ", \n");
+				$indices[] = dbDelta_unifyIndexLine( $fld );
 				break;
 			}
 			$fld = trim($fld);
@@ -1552,7 +1571,7 @@
 			// If the table field exists in the field array...
 			if (array_key_exists(strtolower($tablefield->Field), $cfields)) {
 				// Get the field type from the query
-				preg_match("|".$tablefield->Field." ([^ ]*( unsigned)?)|i", $cfields[strtolower($tablefield->Field)], $matches);
+				preg_match("|".$tablefield->Field."\s+([^ ]*( unsigned)?)|i", $cfields[strtolower($tablefield->Field)], $matches);
 				$fieldtype = $matches[1];
 
 				// Is actual field type different from the field type in query?
@@ -1628,6 +1647,7 @@
 				}
 				// Add the column list to the index create string
 				$index_string .= ' ('.$index_columns.')';
+				$index_string = dbDelta_unifyIndexLine( $index_string );
 				if (!(($aindex = array_search($index_string, $indices)) === false)) {
 					unset($indices[$aindex]);
 					//echo "<pre style=\"border:1px solid #ccc;margin-top:5px;\">{$table}:<br />Found index:".$index_string."</pre>\n";
