#36261: `icontains` lookup doesn't work with case insensitive collations
-------------------------------------+-------------------------------------
     Reporter:  Craig de Stigter     |                    Owner:  (none)
         Type:  Bug                  |                   Status:  new
    Component:  Database layer       |                  Version:
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:
     Keywords:                       |             Triage Stage:
                                     |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Comment (by Simon Charette):

 [https://www.depesz.com/2025/01/10/waiting-for-postgresql-18-support-like-
 with-nondeterministic-collations/ Relevant article on the subject].

 It appears that Postgres 18+ does support `LIKE` against nondeterministic
 collations so that should be taken into consideration when taking a
 decision here.

 > It seems that icontains (and iexact etc) comparisons should use ILIKE,
 which would work fine in this situation

 Are you sure of that? It appears that `ILIKE` is explicitly pointed out as
 not being implemented as
 
[https://git.postgresql.org/gitweb/?p=postgresql.git;a=commitdiff;h=85b7efa1cdd63c2fe2b70b725b8285743ee5787f
 it's unclear whether or not it makes sense].

 > I have looked through git and ticket history and can't find any
 discussion of why it's implemented using LIKE instead.

 Some context for you

 - ticket:3575#comment:5
 - ticket:32485

 > Alternatively, using  x LIKE y COLLATE "default" seems to avoid the
 issue in this case, although someone who knows more about collations
 should probably weigh in on what other side-effects that might have...

 Not an expert but I think this might cause more harm than good as it
 basically ignore the specified collation on the column?
-- 
Ticket URL: <https://code.djangoproject.com/ticket/36261#comment:1>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/django-updates/01070195a1c6c285-f2a17148-4efb-47b5-8e66-008f3359d44e-000000%40eu-central-1.amazonses.com.

Reply via email to