#36880: using hash index as exclusion constraint on USERNAME_FIELD triggers
SystemCheckError
-------------------------------------+-------------------------------------
Reporter: Tilman Koschnick | Type: Bug
Status: new | Component: Database
| layer (models, ORM)
Version: dev | Severity: Normal
Keywords: | Triage Stage:
| Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Hi,
with Postgres, a hash index can be used as an exclusion constraint,
functioning the same way a unique btree based constrained. Support for
this has recently been merged to Django:
[https://code.djangoproject.com/ticket/36827]
Using this on a USERNAME_FIELD can be good for index size and performance.
Currently, the auth system checks doesn't detect a hash exclusion
constraint as a viable option though:
{{{
account.User: (auth.E003) 'User.email' must be unique because it is named
as the 'USERNAME_FIELD'.
}}}
The attached patch enhances the check to consider hash constraints as
well.
Cheers, Til
--
Ticket URL: <https://code.djangoproject.com/ticket/36880>
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/0107019beb833803-34df6c68-d58d-4b67-9155-3edae96b6ca8-000000%40eu-central-1.amazonses.com.