SQLite does case-sensitive searching unless you specify COLLATE NOCASE when creating the database schema, or include COLLATE NOCASE in the select clause. MySQL and Postgres are case-insensitive by default. In the interest of uniformity, I propose that the SQLite driver include COLLATE NOCASE in all column creations by default, unless a local override is provided via the schema API. Here's a (very lightly tested) diff:

--- schema.inc  (revision 1568)
+++ schema.inc  (working copy)
@@ -181,6 +181,8 @@
       if (empty($spec['not null']) && !isset($spec['default'])) {
         $sql .= ' DEFAULT NULL';
       }
+
+      $sql .= ' COLLATE NOCASE';
     }
     return $sql;
   }

Comments

tjg created an issue. See original summary.

tjg’s picture

Issue summary: View changes
tjg’s picture

Title: SQLite Drive Should Use COLLATE NOCASE » SQLite Driver Should Use COLLATE NOCASE
andypost’s picture

I'm sure it should be configurable, otherwise autocomplete works wrong
D8 issue is #2607432: SQLite driver does not allow for case insensitive LIKE comparisons on non-ASCII characters

andypost’s picture

wim leers’s picture

Status: Active » Postponed (maintainer needs more info)
Related issues: +#2454733: Add a user-space case-insensitive collation to the SQLite driver

Status: Postponed (maintainer needs more info) » Closed (outdated)

Automatically closed because Drupal 7 security and bugfix support has ended as of 5 January 2025. If the issue verifiably applies to later versions, please reopen with details and update the version.