Opened 8 years ago

Closed 8 years ago

#9905 closed (fixed)

SQLite case-insensitive problem

Reported by: guard Owned by: mtredinnick
Component: Documentation Version: 1.0
Severity: Keywords: SQLite, DB, case-insensitive
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:


It's known (stated in the SQLite FAQ) that SQLite does not support Unicode LIKE, which leads to Django behaving different on different DBs (see corresponding conversation on the list).

It looks that it can be fixed in the following way:

  • including the pre-compiled SqliteIcu libraries
  • patching the DB code so that it loads extension when creating DB connection if the engine is 'sqlite'

Unfortunately I'm noob to Python and still have not found the full solution (i.e. where do icu.c really lives in the SQLite code, what pysqlite method should be actually called, and what is the place in Django code where the DB conn is created)

Change History (3)

comment:1 Changed 8 years ago by mtredinnick

  • Component changed from Database layer (models, ORM) to Documentation
  • Needs documentation unset
  • Needs tests unset
  • Owner changed from nobody to mtredinnick
  • Patch needs improvement unset
  • Status changed from new to assigned

It isn't valid to assume or expect Django to behave the same on any or all database backends. There are far too many differences between them. It's like hoping that each web browser renders things exactly the same. There are a lot of cases where Django simply returns "whatever the database does" and developers should certainly test their applications on the database they are deploying to.

If you (or somebody) wanted to use the lcu extensions, it would be easy enough to write a custom database backend that included those, but this isn't something we should require/include by default. SQLite is for simple, out-of-the-box deployments and full functionality doesn't require this change. We should add something to the docs to note this, but it's not worth making code changes for.

comment:2 Changed 8 years ago by mtredinnick

(In [9705]) Documented that case-insensitive matching is not supported for non-ASCII
strings in SQLite. Refs #9905.

comment:3 Changed 8 years ago by mtredinnick

  • Resolution set to fixed
  • Status changed from assigned to closed

I've documented the existing behaviour in the above commit (and, similarly on the 1.0.X branch). Somebody might want to write some Python overrides to implement this at some point. If that patch gets written, a new ticket can be opened. I'll close this for now for the reasons given in comment:1

Note: See TracTickets for help on using tickets.
Back to Top