#32370: Model._perform_unique_checks cannot properly validate simultaneous 
adding
and changing
-------------------------------------+-------------------------------------
               Reporter:  Roman      |          Owner:  nobody
                   Type:  Bug        |         Status:  new
              Component:  Database   |        Version:  3.1
  layer (models, ORM)                |
               Severity:  Normal     |       Keywords:
           Triage Stage:             |      Has patch:  0
  Unreviewed                         |
    Needs documentation:  0          |    Needs tests:  0
Patch needs improvement:  0          |  Easy pickings:  0
                  UI/UX:  0          |
-------------------------------------+-------------------------------------
 Imagine there is a model with a unique field.
 {{{
 class Test(models.Model):
     index = models.PositiveIntegerField()
     name = models.CharField(max_length=256)

     class Meta:
         constraints = (
             models.UniqueConstraint(
                 fields=('index'),
                 name='%(app_label)s_%(class)s_U1'),
         )
 }}}

 If I have one model with values (0, "old") and then try to update existing
 model to (1, "old") and simultaneously add (0, "new"), checks in
 Model._perform_unique_checks fail, despite there will be no constraint
 violation at the end of transaction.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/32370>
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/049.79e5c03569efa67a55887d48f9dd4940%40djangoproject.com.

Reply via email to