Opened 21 months ago

Closed 21 months ago

Last modified 7 months ago

#33872 closed Cleanup/optimization (fixed)

Deprecate CICharField, CIEmailField, CITextField.

Reported by: Mariusz Felisiak Owned by: Mariusz Felisiak
Component: contrib.postgres Version: dev
Severity: Normal Keywords:
Cc: Tom Carrick, Carlton Gibson Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


Django 3.2+ supports db_collation for CharField and TextField (see #31777) along with migration operations (CreateCollation(), RemoveCollation()) and the database function Collate() (see #21181). Moreover CI fields and the entire citext module are discouraged since PostgreSQL 12 (which is the minimum version supported by Django 4.2+) in favor of collations. I think it's time to deprecate CI fields from the contrib.postgres in favor of CharField and TextField with case insensitive collations.

Related discussion on the django-developers mailing list.

Change History (8)

comment:1 by Mariusz Felisiak, 21 months ago

Owner: set to Mariusz Felisiak
Status: newassigned

comment:2 by Carlton Gibson, 21 months ago

Triage Stage: UnreviewedAccepted

Accepting based on discussion (+3:-0 I think)

Points were to ensure we document a migration, and perhaps how to avoid needing the CI field ("...put an index on UPPER and make sure you always use iexact.")

comment:3 by Mariusz Felisiak, 21 months ago

Has patch: set

comment:4 by Carlton Gibson, 21 months ago

Triage Stage: AcceptedReady for checkin

comment:5 by GitHub <noreply@…>, 21 months ago

Resolution: fixed
Status: assignedclosed

In cb791a25:

Fixed #33872 -- Deprecated django.contrib.postgres.fields.CIText/CICharField/CIEmailField/CITextField.

comment:6 by Johannes Maron, 12 months ago

Triage Stage: Ready for checkinUnreviewed

In case my mailing list comment gets lost, I make this as unreviewed and leave a copy here:

Hi there,

I am sorry that I missed this in the alpha. But to the best of my knowledge, CITEXT and non-deterministic collations are not the same. They don't support the same operations and their string comparison operations are similar, yet not identical.
Furthermore, PostgreSQL doesn't discourage the use of CITEXT, but hints towards a native alternative. That's maybe more than just a subtle difference.

99% of all use-cases might be email, but even email LIKE-queries would be affected (good for +-searches).

Unless we want to drop support for the CITEXT extension, collations might not be a sufficient replacement.

I'd caution to revert the deprecation and keep support unless we make an informed decision to drop CITEXT for a 3rd party integration.


comment:7 by Mariusz Felisiak, 12 months ago

Triage Stage: UnreviewedReady for checkin

Please don't reopen/change closed tickets. If you want to report a bug, create a separate ticket.

comment:8 by Mariusz Felisiak <felisiak.mariusz@…>, 7 months ago

In 04eb1b4:

Refs #33872 -- Removed django.contrib.postgres.fields.CIText/CICharField/CIEmailField/CITextField.

Per deprecation timeline.

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