#33335: Detecting uniqueness doesn't work for models with functional unique
constraints.
-------------------------------------+-------------------------------------
Reporter: Hervé Le Roy | Owner: Hannes
| Ljungberg
Type: Bug | Status: assigned
Component: Database layer | Version: 4.0
(models, ORM) |
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Mariusz Felisiak):
Replying to [comment:8 Hannes Ljungberg]:
> PR: https://github.com/django/django/pull/15154
>
> Figured we should just exclude UniqueConstraints containing expressions
for any logic revolving around
[https://github.com/django/django/blob/93ba389d81b51ab9b511bae0813958397e1297cd/django/db/models/options.py#L860-L872
Options.total_unique_constraints()], we already discard conditional
constraints here. I can't imagine any realistic way to run the unique
validation checks against expression constraints.
IMO it's feasible to validate against functional constraints, but it would
be tricky and it's too late to include this in Django 4.0. `expressions`
could be passed and handled separately in `Model._perform_unique_checks()`
for example by adding custom annotations 🤔 However, let's ignore them for
now.
--
Ticket URL: <https://code.djangoproject.com/ticket/33335#comment:10>
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 on the web visit
https://groups.google.com/d/msgid/django-updates/064.3a59d0b495ec014440e1d59bcfd6eb79%40djangoproject.com.