Re: [Django] #32967: Buggy Migrations when `float("nan")` in `Q` objects

2021-07-28 Thread Django
#32967: Buggy Migrations when `float("nan")` in `Q` objects
-+-
 Reporter:  Steven Jin   |Owner:  Steven
 |  Jin
 Type:  Bug  |   Status:  closed
Component:  Database layer   |  Version:  3.2
  (models, ORM)  |
 Severity:  Normal   |   Resolution:  wontfix
 Keywords:  db Q | Triage Stage:
 |  Unreviewed
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Steven Jin):

 Thanks!

 Replying to [comment:8 Simon Charette]:
 > Have you tried to simply compare against the `NaN` string?
 >
 > {{{#!python
 > ~CheckConstraint(check=Q(x='NaN'), name="not_nan")
 > }}}
 >
 > It seems to work for me on PostgreSQL.

-- 
Ticket URL: 
Django 
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.cb9c7ee95b775275c0464318297bf756%40djangoproject.com.


Re: [Django] #32967: Buggy Migrations when `float("nan")` in `Q` objects

2021-07-28 Thread Django
#32967: Buggy Migrations when `float("nan")` in `Q` objects
-+-
 Reporter:  Steven Jin   |Owner:  Steven
 |  Jin
 Type:  Bug  |   Status:  closed
Component:  Database layer   |  Version:  3.2
  (models, ORM)  |
 Severity:  Normal   |   Resolution:  wontfix
 Keywords:  db Q | Triage Stage:
 |  Unreviewed
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Simon Charette):

 Have you tried to simply compare against the `NaN` string?

 {{{#!python
 ~CheckConstraint(check=Q(x='NaN'), name="not_nan")
 }}}

 It seems to work for me on PostgreSQL.

-- 
Ticket URL: 
Django 
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.f213eba3917ee9ede8ead97101734aa1%40djangoproject.com.


Re: [Django] #32967: Buggy Migrations when `float("nan")` in `Q` objects

2021-07-28 Thread Django
#32967: Buggy Migrations when `float("nan")` in `Q` objects
-+-
 Reporter:  Steven Jin   |Owner:  Steven
 |  Jin
 Type:  Bug  |   Status:  closed
Component:  Database layer   |  Version:  3.2
  (models, ORM)  |
 Severity:  Normal   |   Resolution:  wontfix
 Keywords:  db Q | Triage Stage:
 |  Unreviewed
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Steven Jin):

 Thanks for the reply! How would I ensure that values in a column are not
 `nan`?

-- 
Ticket URL: 
Django 
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.299a45e6cad7ebeffcfd6f459cbf9a08%40djangoproject.com.


Re: [Django] #32967: Buggy Migrations when `float("nan")` in `Q` objects

2021-07-27 Thread Django
#32967: Buggy Migrations when `float("nan")` in `Q` objects
-+-
 Reporter:  Steven Jin   |Owner:  Steven
 |  Jin
 Type:  Bug  |   Status:  closed
Component:  Database layer   |  Version:  3.2
  (models, ORM)  |
 Severity:  Normal   |   Resolution:  wontfix
 Keywords:  db Q | Triage Stage:
 |  Unreviewed
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Mariusz Felisiak):

 * status:  assigned => closed
 * resolution:   => wontfix


Comment:

 Thanks for the report, however it looks like a hypothetical issue, what do
 you want to check with such constraint? (`float('nan') != whatever)`.
 `FloatField` uses a proper data type and this should be ensured on a
 database layer without extra constraints. I don't think it's worth
 additional complexity.

-- 
Ticket URL: 
Django 
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.88e1253765ccf17eb31acbb49e629405%40djangoproject.com.


Re: [Django] #32967: Buggy Migrations when `float("nan")` in `Q` objects

2021-07-27 Thread Django
#32967: Buggy Migrations when `float("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:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Steven Jin):

 * status:  new => assigned


-- 
Ticket URL: 
Django 
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.1301197137dd222f80e6b5b52fd1e08d%40djangoproject.com.


Re: [Django] #32967: Buggy Migrations when `float("nan")` in `Q` objects

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

 * status:  closed => new
 * resolution:  fixed =>


-- 
Ticket URL: 
Django 
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.c6a3338a9660283b3b6aa9702517e5cd%40djangoproject.com.


Re: [Django] #32967: Buggy Migrations when `float("nan")` in `Q` objects

2021-07-27 Thread Django
#32967: Buggy Migrations when `float("nan")` in `Q` objects
-+-
 Reporter:  Steven Jin   |Owner:  Steven
 |  Jin
 Type:  Bug  |   Status:  closed
Component:  Database layer   |  Version:  3.2
  (models, ORM)  |
 Severity:  Normal   |   Resolution:  fixed
 Keywords:  db Q | Triage Stage:
 |  Unreviewed
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Steven Jin):

 * cc: Steven Jin (added)
 * status:  assigned => closed
 * has_patch:  0 => 1
 * resolution:   => fixed


Old 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")`.

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")`.

 See PR: https://github.com/django/django/pull/14706

--

-- 
Ticket URL: 
Django 
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.7fa9422e683c6fcac6b93fde19ae4395%40djangoproject.com.


Re: [Django] #32967: Buggy Migrations when `float("nan")` in `Q` objects (was: Buggy Migrations when `flota("nan")` in `Q` objects)

2021-07-27 Thread Django
#32967: Buggy Migrations when `float("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
-+-

-- 
Ticket URL: 
Django 
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.6da6151d3816428cb62361cf7b831f0a%40djangoproject.com.