#36880: Postgres hash exclusion constraints are not considered totally unique
-------------------------------------+-------------------------------------
Reporter: Tilman Koschnick | Owner: (none)
Type: Bug | Status: new
Component: Database layer | Version: dev
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Simon Charette):
* needs_better_patch: 0 => 1
* stage: Unreviewed => Accepted
* summary:
using hash index as exclusion constraint on USERNAME_FIELD triggers
SystemCheckError
=> Postgres hash exclusion constraints are not considered totally
unique
Comment:
Accepting on the basis that the check logic should be able to consider all
type of unique constraints but the proposed patch is inadequate.
What should be done instead is find a way to have
`django.db.models.options.Options.total_unique_constraints` include such
constraint in a way that doesn't couple `contrib.postgres` with core.
A potential solution could be to introduce a
`Constraint.totally_unique_for_fields -> set[tuple[str]] | None` method
which is implemented by `UniqueConstraint` and `ExclusionConstraint`.
--
Ticket URL: <https://code.djangoproject.com/ticket/36880#comment:1>
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/0107019bebbfb5b3-1c459c00-8b35-458d-b6a9-52620565b9fb-000000%40eu-central-1.amazonses.com.