diff --git a/includes/database/mysql/schema.inc b/includes/database/mysql/schema.inc
index 4e88fa1..d0f4259 100644
--- a/includes/database/mysql/schema.inc
+++ b/includes/database/mysql/schema.inc
@@ -131,8 +131,13 @@ class DatabaseSchema_mysql extends DatabaseSchema {
   protected function createFieldSql($name, $spec) {
     $sql = "`" . $name . "` " . $spec['mysql_type'];
 
-    if (in_array($spec['mysql_type'], array('VARCHAR', 'CHAR', 'TINYTEXT', 'MEDIUMTEXT', 'LONGTEXT', 'TEXT')) && isset($spec['length'])) {
-      $sql .= '(' . $spec['length'] . ')';
+    if (in_array($spec['mysql_type'], array('VARCHAR', 'CHAR', 'TINYTEXT', 'MEDIUMTEXT', 'LONGTEXT', 'TEXT'))) {
+      if (isset($spec['length'])) {
+        $sql .= '(' . $spec['length'] . ')';
+      }
+      if (!empty($spec['binary'])) {
+        $sql .= ' BINARY';
+      }
     }
     elseif (isset($spec['precision']) && isset($spec['scale'])) {
       $sql .= '(' . $spec['precision'] . ', ' . $spec['scale'] . ')';
diff --git a/includes/database/schema.inc b/includes/database/schema.inc
index de1b2f5..69c19c5 100644
--- a/includes/database/schema.inc
+++ b/includes/database/schema.inc
@@ -76,6 +76,9 @@ require_once dirname(__FILE__) . '/query.inc';
  *       the precision (total number of significant digits) and scale
  *       (decimal digits right of the decimal point). Both values are
  *       mandatory. Ignored for other field types.
+ *     - 'binary': For type 'char', 'varchar' or 'text' fields on MySQL, forces
+ *       a case-sensitive binary collation. This has no effect on other database
+ *       types for which case sensitivity is already the default behavior.
  *     All parameters apart from 'type' are optional except that type
  *     'numeric' columns must specify 'precision' and 'scale'.
  *  - 'primary key': An array of one or more key column specifiers (see below)
diff --git a/modules/simpletest/tests/file.test b/modules/simpletest/tests/file.test
index 9dbe546..6c4c2d4 100644
--- a/modules/simpletest/tests/file.test
+++ b/modules/simpletest/tests/file.test
@@ -2024,6 +2024,19 @@ class FileSaveTest extends FileHookTestCase {
     $loaded_file = db_query('SELECT * FROM {file_managed} f WHERE f.fid = :fid', array(':fid' => $saved_file->fid))->fetch(PDO::FETCH_OBJ);
     $this->assertNotNull($loaded_file, t("Record still exists in the database."), 'File');
     $this->assertEqual($loaded_file->status, $saved_file->status, t("Status was saved correctly."));
+
+    // Try to insert a second file with the same name apart from case insensitivity
+    // to ensure the 'uri' index allows for filenames with different cases.
+    $file = (object) array(
+      'uid' => 1,
+      'filename' => 'DRUPLICON.txt',
+      'uri' => 'public://DRUPLICON.txt',
+      'filemime' => 'text/plain',
+      'timestamp' => 1,
+      'status' => FILE_STATUS_PERMANENT,
+    );
+    file_put_contents($file->uri, 'hello world');
+    file_save($file);
   }
 }
 
diff --git a/modules/system/system.install b/modules/system/system.install
index 6d80c43..a318f4f 100644
--- a/modules/system/system.install
+++ b/modules/system/system.install
@@ -808,6 +808,7 @@ function system_schema() {
         'length' => 255,
         'not null' => TRUE,
         'default' => '',
+        'binary' => TRUE,
       ),
       'filemime' => array(
         'description' => "The file's MIME type.",
diff --git a/modules/update/update.test b/modules/update/update.test
index e72f4c5..0cf1495 100644
--- a/modules/update/update.test
+++ b/modules/update/update.test
@@ -441,6 +441,11 @@ class UpdateTestContribCase extends UpdateTestHelper {
         'hidden' => FALSE,
       ),
     );
+    // @todo: when there are contributed modules in the site's file system, the
+    // total number off attempts made in the test may exceed the default value
+    // of update_mx_fetch_attempts. There for this site is set ridiculously
+    // high to avoid test failures in those cases.
+    variable_set('update_max_fetch_attempts', 99999);
     variable_set('update_test_system_info', $system_info);
     $xml_mapping = array(
       'drupal' => '0',
@@ -634,7 +639,7 @@ class UpdateTestUploadCase extends UpdateTestHelper {
    * Ensure that archiver extensions are properly merged in the UI.
    */
   function testFileNameExtensionMerging() {
-    $this->drupalGet('admin/modules/install');    
+    $this->drupalGet('admin/modules/install');
     // Make sure the bogus extension supported by update_test.module is there.
     $this->assertPattern('/file extensions are supported:.*update-test-extension/', t("Found 'update-test-extension' extension"));
     // Make sure it didn't clobber the first option from core.
