#32967: Buggy Migrations when `flota("nan")` in `Q` objects
-------------------------------------+-------------------------------------
     Reporter:  Steven Jin           |                    Owner:  Steven
                                     |  Jin
         Type:  Bug                  |                   Status:  assigned
    Component:  Database layer       |                  Version:  3.2
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:
     Keywords:  db Q                 |             Triage Stage:
                                     |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Description changed by Steven Jin:

Old description:

> When creating a `CheckConstraint` in the form
>
> {{{#!python
> class MyModel
>   x = FloatField()
>   class Meta:
>     constraints = [~CheckConstraint(check=Q(x=float("nan")), name="some
> constraint")]
> }}}
>
> This constraint is removed and added back every time `python manage.py
> makemigrations` is run. This is because the inherited `__eq__` function
> of `Q` objects does not take into account the fact that `float("nan") !=
> float("nan")`.

New description:

 When creating a `CheckConstraint` in the form

 {{{#!python
 class MyModel(Model):
   x = FloatField()
   class Meta:
     constraints = [~CheckConstraint(check=Q(x=float("nan")), name="some
 constraint")]
 }}}

 This constraint is removed and added back every time `python manage.py
 makemigrations` is run. This is because the inherited `__eq__` function of
 `Q` objects does not take into account the fact that `float("nan") !=
 float("nan")`.

--

-- 
Ticket URL: <https://code.djangoproject.com/ticket/32967#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 django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/068.ebdf5f9809e4c1e9d2d0efe235f02de3%40djangoproject.com.

Reply via email to