Index: includes/database/mysql/schema.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/database/mysql/schema.inc,v
retrieving revision 1.13
diff -u -p -r1.13 schema.inc
--- includes/database/mysql/schema.inc	1 Apr 2009 20:00:46 -0000	1.13
+++ includes/database/mysql/schema.inc	2 Apr 2009 13:16:47 -0000
@@ -60,8 +60,7 @@ class DatabaseSchema_mysql extends Datab
    */
   protected function createTableSql($name, $table) {
     if (empty($table['mysql_suffix'])) {
-      // Store strings as UTF-8 and do case-sensitive comparision.
-      $table['mysql_suffix'] = 'DEFAULT CHARACTER SET UTF8 COLLATE utf8_bin';
+      $table['mysql_suffix'] = 'DEFAULT CHARACTER SET UTF8';
     }
 
     $sql = "CREATE TABLE {" . $name . "} (\n";
Index: includes/database/pgsql/database.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/database/pgsql/database.inc,v
retrieving revision 1.20
diff -u -p -r1.20 database.inc
--- includes/database/pgsql/database.inc	1 Apr 2009 20:00:46 -0000	1.20
+++ includes/database/pgsql/database.inc	2 Apr 2009 13:16:47 -0000
@@ -97,8 +97,13 @@ class DatabaseConnection_pgsql extends D
   }
 
   public function mapConditionOperator($operator) {
-    // We don't want to override any of the defaults.
-    return NULL;
+    static $specials = array(
+      // In PostgreSQL, 'LIKE' is case-sensitive. For case-insensitive LIKE
+      // statements, we need to use ILIKE instead.
+      'LIKE' => array('operator' => 'ILIKE'),
+    );
+
+    return isset($specials[$operator]) ? $specials[$operator] : NULL;
   }
 
   /**
Index: includes/database/sqlite/database.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/database/sqlite/database.inc,v
retrieving revision 1.13
diff -u -p -r1.13 database.inc
--- includes/database/sqlite/database.inc	1 Apr 2009 20:00:46 -0000	1.13
+++ includes/database/sqlite/database.inc	2 Apr 2009 13:16:47 -0000
@@ -31,7 +31,6 @@ class DatabaseConnection_sqlite extends 
     ));
 
     $this->exec('PRAGMA encoding="UTF-8"');
-    $this->exec('PRAGMA case_sensitive_like=1');
 
     // Create functions needed by SQLite.
     $this->sqliteCreateFunction('if', array($this, 'sqlFunctionIf'));
Index: modules/locale/locale.install
===================================================================
RCS file: /cvs/drupal/drupal/modules/locale/locale.install,v
retrieving revision 1.35
diff -u -p -r1.35 locale.install
--- modules/locale/locale.install	1 Apr 2009 20:00:46 -0000	1.35
+++ modules/locale/locale.install	2 Apr 2009 13:16:49 -0000
@@ -350,6 +350,7 @@ function locale_schema() {
       ),
       'source' => array(
         'type' => 'text',
+        'mysql_type' => 'blob',
         'not null' => TRUE,
         'description' => 'The original string in English.',
       ),
@@ -378,6 +379,7 @@ function locale_schema() {
       ),
       'translation' => array(
         'type' => 'text',
+        'mysql_type' => 'blob',
         'not null' => TRUE,
         'description' => 'Translation string value in this language.',
       ),
Index: modules/locale/locale.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/locale/locale.test,v
retrieving revision 1.22
diff -u -p -r1.22 locale.test
--- modules/locale/locale.test	1 Apr 2009 20:00:46 -0000	1.22
+++ modules/locale/locale.test	2 Apr 2009 13:16:49 -0000
@@ -391,9 +391,8 @@ class LocaleTranslationFunctionalTest ex
     // This is the language indicator on the translation search screen for
     // untranslated strings. Copied straight from locale.inc.
     $language_indicator = "<em class=\"locale-untranslated\">$langcode</em> ";
-    // This will be the translation of $name. Make sure it contains at least
-    // one lower-case character in order to check case-sensitive search.
-    $translation = $this->randomName(16) . 'x';
+    // This will be the translation of $name.
+    $translation = $this->randomName(16);
 
     // Add custom language.
     $this->drupalLogin($admin_user);
@@ -470,16 +469,6 @@ class LocaleTranslationFunctionalTest ex
     $this->drupalPost('admin/international/translate/translate', $search, t('Filter'));
     $this->assertNoText(t('No strings found for your search.'), t('Search found the translation.'));
 
-    // Ensure string search is case-sensitive.
-    $search = array(
-      'string' => drupal_strtoupper($translation),
-      'language' => 'all',
-      'translation' => 'translated',
-      'group' => 'all',
-    );
-    $this->drupalPost('admin/international/translate/translate', $search, t('Filter'));
-    $this->assertText(t('No strings found for your search.'), t("Search didn't find the translation."));
-
     // Ensure translated source string doesn't appear if searching on 'only
     // untranslated strings'.
     $search = array(
Index: modules/simpletest/tests/database_test.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/simpletest/tests/database_test.test,v
retrieving revision 1.48
diff -u -p -r1.48 database_test.test
--- modules/simpletest/tests/database_test.test	1 Apr 2009 20:00:46 -0000	1.48
+++ modules/simpletest/tests/database_test.test	2 Apr 2009 13:16:50 -0000
@@ -1995,34 +1995,6 @@ class DatabaseRegressionTestCase extends
     $this->assertTrue(db_table_exists('node'), t('Returns true for existent table.'));
     $this->assertFalse(db_table_exists('nosuchtable'), t('Returns false for nonexistent table.'));
   }
-
-  /**
-   * Test that string comparison is case-sensitive.
-   */
-  function testCaseSensitiviteCompare() {
-    $num_matches = db_query("SELECT COUNT(*) FROM {test} WHERE name = :name", array(':name' => 'George'))->fetchField();
-    $this->assertEqual($num_matches, 1, t('Correct number of records found with proper case.'));
-    $num_matches = db_query("SELECT COUNT(*) FROM {test} WHERE name = :name", array(':name' => 'GEORGE'))->fetchField();
-    $this->assertEqual($num_matches, 0, t('Correct number of records found with wrong case.'));
-
-    $num_matches = db_query("SELECT COUNT(*) FROM {test} WHERE name LIKE :name", array(':name' => 'Geo%'))->fetchField();
-    $this->assertEqual($num_matches, 1, t('Correct number of records found with proper case.'));
-    $num_matches = db_query("SELECT COUNT(*) FROM {test} WHERE name LIKE :name", array(':name' => 'GEO%'))->fetchField();
-    $this->assertEqual($num_matches, 0, t('Correct number of records found with wrong case.'));
-
-    $num_matches = db_select('test')
-      ->condition('name', 'Geo%', 'LIKE')
-      ->countQuery()
-      ->execute()
-      ->fetchField();
-    $this->assertEqual($num_matches, 1, t('Correct number of records found with proper case.'));
-    $num_matches = db_select('test')
-      ->condition('name', 'GEO%', 'LIKE')
-      ->countQuery()
-      ->execute()
-      ->fetchField();
-    $this->assertEqual($num_matches, 0, t('Correct number of records found with wrong case.'));
-  }
 }
 
 /**
Index: modules/statistics/statistics.admin.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/statistics/statistics.admin.inc,v
retrieving revision 1.20
diff -u -p -r1.20 statistics.admin.inc
--- modules/statistics/statistics.admin.inc	1 Apr 2009 20:00:47 -0000	1.20
+++ modules/statistics/statistics.admin.inc	2 Apr 2009 13:16:50 -0000
@@ -107,8 +107,8 @@ function statistics_top_visitors() {
  * Menu callback; presents the "referrer" page.
  */
 function statistics_top_referrers() {
-  $query = "SELECT url, COUNT(url) AS hits, MAX(timestamp) AS last FROM {accesslog} WHERE LOWER(url) NOT LIKE :host AND url <> '' GROUP BY url";
-  $query_cnt = "SELECT COUNT(DISTINCT(url)) FROM {accesslog} WHERE url <> '' AND LOWER(url) NOT LIKE :host";
+  $query = "SELECT url, COUNT(url) AS hits, MAX(timestamp) AS last FROM {accesslog} WHERE url NOT LIKE :host AND url <> '' GROUP BY url";
+  $query_cnt = "SELECT COUNT(DISTINCT(url)) FROM {accesslog} WHERE url <> '' AND url NOT LIKE :host";
   drupal_set_title(t('Top referrers in the past %interval', array('%interval' => format_interval(variable_get('statistics_flush_accesslog_timer', 259200)))), PASS_THROUGH);
 
   $header = array(
Index: modules/system/system.install
===================================================================
RCS file: /cvs/drupal/drupal/modules/system/system.install,v
retrieving revision 1.313
diff -u -p -r1.313 system.install
--- modules/system/system.install	1 Apr 2009 20:00:47 -0000	1.313
+++ modules/system/system.install	2 Apr 2009 13:16:52 -0000
@@ -3068,29 +3068,10 @@ function system_update_7011() {
 }
 
 /**
- * Make tables case-sensitive on MySQL.
- */
-function system_update_7012() {
-  $ret = array();
-  if (db_driver() == 'mysql') {
-    // Table names as used in D6. Some have changed and are no longer reported
-    // by hook_schema(). The list is generated using the following command:
-    // grep -r "^ \+\$schema\['[a-z_]\+'\] =" modules | cut -d\' -f2 | sort -u | xargs -I '*' echo -n "'*', "
-    $tables = array('access', 'accesslog', 'actions', 'actions_aid', 'aggregator_category', 'aggregator_category_feed', 'aggregator_category_item', 'aggregator_feed', 'aggregator_item', 'authmap', 'batch', 'blocks', 'blocks_roles', 'blogapi_files', 'book', 'book_temp', 'boxes', 'cache', 'cache_block', 'cache_filter', 'cache_form', 'cache_menu', 'cache_page', 'cache_update', 'comments', 'contact', 'files', 'filter_formats', 'filters', 'flood', 'forum', 'history', 'languages', 'locales_source', 'locales_target', 'menu_custom', 'menu_links', 'menu_router', 'node', 'node_access', 'node_comment_statistics', 'node_counter', 'node_revisions', 'node_type', 'openid_association', 'permission', 'poll', 'poll_choices', 'poll_votes', 'profile_fields', 'profile_values', 'role', 'search_dataset', 'search_index', 'search_node_links', 'search_total', 'sessions', 'system', 'term_data', 'term_hierarchy', 'term_node', 'term_relation', 'term_synonym', 'trigger_assignments', 'upload', 'url_alias', 'users', 'users_roles', 'variable', 'vocabulary', 'vocabulary_node_types', 'watchdog');
-    foreach ($tables as $table) {
-      if (db_table_exists($table)) {
-        $ret[] = update_sql('ALTER TABLE {' . $table . '} CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin');
-      }
-    }
-  }
-  return $ret;
-}
-
-/**
  * Rename {blocks} table to {block}, {blocks_roles} to {block_role} and
  * {boxes} to {box}.
  */
-function system_update_7013() {
+function system_update_7012() {
   $ret = array();
   db_rename_table($ret, 'blocks', 'block');
   db_rename_table($ret, 'blocks_roles', 'block_role');
@@ -3101,7 +3082,7 @@ function system_update_7013() {
 /**
  * Convert default time zone offset to default time zone name.
  */
-function system_update_7014() {
+function system_update_7013() {
   $ret = array();
   $timezone = NULL;
   $timezones = system_time_zones();
@@ -3142,7 +3123,7 @@ function system_update_7014() {
 /**
  * Drop the bootstrap column from the {system} table.
  */
-function system_update_7015() {
+function system_update_7014() {
   $ret = array();
   db_drop_field($ret, 'system', 'bootstrap');
   return $ret;
@@ -3151,7 +3132,7 @@ function system_update_7015() {
 /**
  * Change the user logout path.
  */
-function system_update_7016() {
+function system_update_7015() {
   $ret = array();
   $ret[] = update_sql("UPDATE {menu_links} SET link_path = 'user/logout' WHERE link_path = 'logout'");
   $ret[] = update_sql("UPDATE {menu_links} SET router_path = 'user/logout' WHERE router_path = 'logout'");
@@ -3161,7 +3142,7 @@ function system_update_7016() {
 /**
  * Remove custom datatype *_unsigned in PostgreSQL.
  */
-function system_update_7017() {
+function system_update_7016() {
   $ret = array();
   // Only run these queries if the driver used is pgsql.
   if (db_driver() == 'pgsql') {
@@ -3195,7 +3176,7 @@ function system_update_7017() {
 /**
  * Change the theme setting 'toggle_node_info' into a per content type variable.
  */
-function system_update_7018() {
+function system_update_7017() {
   $ret = array();
   $types = node_get_types();
   if (count($types)) {
@@ -3224,7 +3205,7 @@ function system_update_7018() {
 /**
  * Replace src index on the {url_alias} table with src, language.
  */
-function system_update_7019() {
+function system_update_7018() {
   $ret = array();
   db_add_index($ret, 'url_alias', 'src_language', array('src', 'language'));
   db_drop_index($ret, 'url_alias', 'src');
@@ -3235,7 +3216,7 @@ function system_update_7019() {
 /**
  * Shorten the {system}.type column and add an index on type and name.
  */
-function system_update_7020() {
+function system_update_7019() {
   $ret = array();
   db_drop_index($ret, 'system', 'modules');
   db_change_field($ret, 'system', 'type', 'type', array('type' => 'varchar', 'length' => 12, 'not null' => TRUE, 'default' => ''));
@@ -3247,7 +3228,7 @@ function system_update_7020() {
 /**
  * Enable field module.
  */
-function system_update_7021() {
+function system_update_7020() {
   $ret = array();
   $module_list = array('field_sql_storage', 'field');
   drupal_install_modules($module_list);
Index: modules/user/user.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/user/user.module,v
retrieving revision 1.973
diff -u -p -r1.973 user.module
--- modules/user/user.module	1 Apr 2009 20:00:47 -0000	1.973
+++ modules/user/user.module	2 Apr 2009 13:16:55 -0000
@@ -216,12 +216,14 @@ function user_load_multiple($uids = arra
     }
     // If the conditions array is populated, add those to the query.
     if ($conditions) {
+      // TODO D7: Using LIKE() to get a case insensitive comparison because Crell
+      // and chx promise that dbtng will map it to ILIKE in postgres.
       if (isset($conditions['name'])) {
-        $query->where('LOWER(u.name) = LOWER(:name)', array(':name' => $conditions['name']));
+        $query->condition('u.name', $conditions['name'], 'LIKE');
         unset($conditions['name']);
       }
       if (isset($conditions['mail'])) {
-        $query->where('LOWER(u.mail) = LOWER(:mail)', array(':mail' => $conditions['mail']));
+        $query->condition('u.mail', $conditions['mail'], 'LIKE');
         unset($conditions['mail']);
       }
       foreach ($conditions as $field => $value) {
