#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 |
Description
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 (10)
comment:1 by , 2 years ago
Owner: | set to |
---|---|
Status: | new → assigned |
comment:2 by , 2 years ago
Triage Stage: | Unreviewed → Accepted |
---|
comment:4 by , 2 years ago
Triage Stage: | Accepted → Ready for checkin |
---|
comment:6 by , 21 months ago
Triage Stage: | Ready for checkin → Unreviewed |
---|
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.
Best
Joe!
comment:7 by , 21 months ago
Triage Stage: | Unreviewed → Ready for checkin |
---|
Please don't reopen/change closed tickets. If you want to report a bug, create a separate ticket.
comment:9 by , 4 months ago
I think this should be reverted, there is no consensus for this deprecation on the mailing list: https://groups.google.com/g/django-developers/c/nDMnO98nexY
comment:10 by , 4 months ago
It's no longer a deprecation, CIText
/CICharField
/CIEmailField
/CITextField
have already been removed in Django 5.1, and (as far as I'm aware) it's too late to change this decision and add them back to the core. You can always use django-citext
if really need to use them.
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.")