[Django] #33228: Change BaseDatabaseFeatures.has_case_insensitive_like to False

7 views
Skip to first unread message

Django

unread,
Oct 25, 2021, 8:31:55 PM10/25/21
to django-...@googlegroups.com
#33228: Change BaseDatabaseFeatures.has_case_insensitive_like to False
-------------------------------------+-------------------------------------
Reporter: Tim | Owner: nobody
Graham |
Type: | Status: new
Cleanup/optimization |
Component: Database | Version: dev
layer (models, ORM) |
Severity: Normal | Keywords:
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 1
UI/UX: 0 |
-------------------------------------+-------------------------------------
It seems that a better default for this feature would be `False`, as of
the built-in backends, only SQLite uses `True`. In addition, all three of
the databases I've built third-party backends for (Cloud Spanner,
CockroachDB, Snowflake) all use `False`. Of course, a mention in the
release notes that the default is changed is still appropriate.

--
Ticket URL: <https://code.djangoproject.com/ticket/33228>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Oct 26, 2021, 12:08:38 AM10/26/21
to django-...@googlegroups.com
#33228: Change BaseDatabaseFeatures.has_case_insensitive_like to False
-------------------------------------+-------------------------------------
Reporter: Tim Graham | Owner: nobody
Type: | Status: new
Cleanup/optimization |
Component: Database layer | Version: dev
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

* stage: Unreviewed => Accepted


--
Ticket URL: <https://code.djangoproject.com/ticket/33228#comment:1>

Django

unread,
Oct 26, 2021, 9:20:46 AM10/26/21
to django-...@googlegroups.com
#33228: Change BaseDatabaseFeatures.has_case_insensitive_like to False
-------------------------------------+-------------------------------------
Reporter: Tim Graham | Owner: Chinmoy
Type: | Status: assigned

Cleanup/optimization |
Component: Database layer | Version: dev
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Chinmoy):

* owner: nobody => Chinmoy
* status: new => assigned


--
Ticket URL: <https://code.djangoproject.com/ticket/33228#comment:2>

Django

unread,
Oct 26, 2021, 4:04:42 PM10/26/21
to django-...@googlegroups.com
#33228: Change BaseDatabaseFeatures.has_case_insensitive_like to False
-------------------------------------+-------------------------------------
Reporter: Tim Graham | Owner: Chinmoy
Type: | Status: assigned
Cleanup/optimization |
Component: Database layer | Version: dev
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Chinmoy):

I was going through the code and after changing the value to `False`, one
of the tests seemed to fail.

{{{
def test_ticket_16731_startswith_lookup(self):
Employee.objects.create(firstname="John", lastname="Doe")
e2 = Employee.objects.create(firstname="Jack", lastname="Jackson")
e3 = Employee.objects.create(firstname="Jack", lastname="jackson")
self.assertSequenceEqual(
Employee.objects.filter(lastname__startswith=F('firstname')),
[e2, e3] if connection.features.has_case_insensitive_like else
[e2]
)
}}}

with the error `AssertionError: Sequences differ: <QuerySet [<Employee:
Jack Jackson>, <Employee: Jack jackson>]> != [<Employee: Jack Jackson>]`.
I don't understand why the query filter returns `<QuerySet [<Employee:
Jack Jackson>, <Employee: Jack jackson>]>` when the default value of
`has_case_insensitive_like` is set to `False`? @Mariusz Felisiak any
suggestion on this?

--
Ticket URL: <https://code.djangoproject.com/ticket/33228#comment:3>

Django

unread,
Oct 26, 2021, 4:10:05 PM10/26/21
to django-...@googlegroups.com
#33228: Change BaseDatabaseFeatures.has_case_insensitive_like to False
-------------------------------------+-------------------------------------
Reporter: Tim Graham | Owner: Chinmoy
Type: | Status: assigned
Cleanup/optimization |
Component: Database layer | Version: dev
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Tim Graham):

You should add `has_case_insensitive_like = True` to the sqlite3 backend
(and remove the now unneeded `has_case_insensitive_like = False` from the
others).

--
Ticket URL: <https://code.djangoproject.com/ticket/33228#comment:4>

Django

unread,
Oct 28, 2021, 10:57:33 AM10/28/21
to django-...@googlegroups.com
#33228: Change BaseDatabaseFeatures.has_case_insensitive_like to False
-------------------------------------+-------------------------------------
Reporter: Tim Graham | Owner: Chinmoy
Type: | Status: assigned
Cleanup/optimization |
Component: Database layer | Version: dev
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim Graham):

* has_patch: 0 => 1
* stage: Accepted => Ready for checkin


Comment:

[https://github.com/django/django/pull/15030 PR]

--
Ticket URL: <https://code.djangoproject.com/ticket/33228#comment:5>

Django

unread,
Oct 28, 2021, 11:56:53 AM10/28/21
to django-...@googlegroups.com
#33228: Change BaseDatabaseFeatures.has_case_insensitive_like to False
-------------------------------------+-------------------------------------
Reporter: Tim Graham | Owner: Chinmoy
Type: | Status: closed

Cleanup/optimization |
Component: Database layer | Version: dev
(models, ORM) |
Severity: Normal | Resolution: fixed

Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by GitHub <noreply@…>):

* status: assigned => closed
* resolution: => fixed


Comment:

In [changeset:"073b7b5915fdfb89a144e81173176ee13ff92a25" 073b7b59]:
{{{
#!CommitTicketReference repository=""
revision="073b7b5915fdfb89a144e81173176ee13ff92a25"
Fixed #33228 -- Changed value of
BaseDatabaseFeatures.has_case_insensitive_like to False.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/33228#comment:6>

Reply all
Reply to author
Forward
0 new messages