[Django] #30248: Implement case insensitive fields in Sqlite

7 views
Skip to first unread message

Django

unread,
Mar 12, 2019, 5:42:10 AM3/12/19
to django-...@googlegroups.com
#30248: Implement case insensitive fields in Sqlite
-------------------------------------+-------------------------------------
Reporter: Stuart | Owner: nobody
Axon |
Type: New | Status: new
feature |
Component: | Version: 2.1
Uncategorized | Keywords: sqlite citext
Severity: Normal | postgres
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
Sqlite supports case insensitive fields by setting COLLATE NOCASE.

This works as you would expect for SELECT and INSERT.


It would be great to have equivalents to the CIText fields in
postgres.contrib - this would make it a lot easier to unit test code using
those fields.

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

Django

unread,
Mar 12, 2019, 6:30:48 AM3/12/19
to django-...@googlegroups.com
#30248: Implement case insensitive fields in Sqlite
-------------------------------------+-------------------------------------
Reporter: Stuart Axon | Owner: nobody
Type: New feature | Status: closed
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution: needsinfo
Keywords: sqlite citext | Triage Stage:
postgres | Unreviewed
Has patch: 0 | Needs documentation: 0

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

* status: new => closed
* resolution: => needsinfo
* version: 2.1 => master
* component: Uncategorized => Database layer (models, ORM)


Comment:

Hi Stuart.

Short answer, "Yes, maybe". :)

First off would be proof-of-concept fields, maybe in a third-party
(similar to exist for MySQL and Postgres already). The `CIText` fields are
fairly minimal, so there may not be much here.

Then an approach to the DevelopersMailingList to see if there were
appetite to include such fields in Django itself. (At that point I'm
wondering if similar isn't supported across all four supported backends,
in which case would we want to pull the fields out of `contrib`...?) — The
issue tracker isn't really the best place for that conversation.

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

Django

unread,
Mar 12, 2019, 2:37:58 PM3/12/19
to django-...@googlegroups.com
#30248: Implement case insensitive fields in Sqlite
-------------------------------------+-------------------------------------
Reporter: Stuart Axon | Owner: nobody
Type: New feature | Status: closed
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution: needsinfo
Keywords: sqlite citext | Triage Stage:
postgres | Unreviewed
Has patch: 0 | Needs documentation: 0

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

Comment (by Nick Pope):

Replying to [comment:1 Carlton Gibson]:


> At that point I'm wondering if similar isn't supported across all four
supported backends, in which case would we want to pull the fields out of
`contrib`...?

If this is possible, it would then make sense to implement
{{{CharField(insensitive=True)}}}, with default of {{{False}}}. Perhaps
this could also work with {{{TextField}}}?

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

Django

unread,
Mar 13, 2019, 5:53:29 AM3/13/19
to django-...@googlegroups.com
#30248: Implement case insensitive fields in Sqlite
-------------------------------------+-------------------------------------
Reporter: Stuart Axon | Owner: nobody
Type: New feature | Status: closed
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution: needsinfo
Keywords: sqlite citext | Triage Stage:
postgres | Unreviewed
Has patch: 0 | Needs documentation: 0

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

Comment (by Carlton Gibson):

Hey Nick.

> If this is possible...

Oh, good idea.

If someone wants to tell me that this is on, happy to see this moved into
the Accepted pile.

(Not sure what thoughts on a `contrib.sqlite` would be if not... —
probably leaning towards third-party I'd guess.)

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

Django

unread,
Mar 13, 2019, 9:58:38 AM3/13/19
to django-...@googlegroups.com
#30248: Implement case insensitive fields in Sqlite
-------------------------------------+-------------------------------------
Reporter: Stuart Axon | Owner: nobody
Type: New feature | Status: closed
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution: needsinfo
Keywords: sqlite citext | Triage Stage:
postgres | Unreviewed
Has patch: 0 | Needs documentation: 0

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

Old description:

> Sqlite supports case insensitive fields by setting COLLATE NOCASE.
>
> This works as you would expect for SELECT and INSERT.
>

> It would be great to have equivalents to the CIText fields in
> postgres.contrib - this would make it a lot easier to unit test code
> using those fields.

New description:

--

Comment (by Stuart Axon):

Cheers, I did send an initial mail to the dev list, but think it might
have got eaten as I didn't see it (also had a bit of bad luck updating
this ticket, updating the description, not leaving a comment).

One thing I found out, is that even with COLLATE NOCASE sqlites regexes
don't default to case insensitive, so that would need some support at the
django end.

I had a bit of a look into how the postgres citext works, but couldn't
work out how to make Operators that integrate with Django in the same way.
I guess a really tiny implementation, as fields.py might be a start ?

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

Reply all
Reply to author
Forward
0 new messages