#33397: Arithmetic operations on DateField/DateTimeField/DurationField
expressions
are buggy.
-------------------------------------+-------------------------------------
Reporter: Luke Plant | Owner: Luke
| Plant
Type: Bug | Status: assigned
Component: Database layer | Version: 4.0
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Mariusz Felisiak):
Note that currently `output_field` has limited scope in what it affects:
- it does not cause a database level `CAST` to be done (see #26650)
- it controls conversion to Python data types, but that doesn't
necessarily include validation, so some invalid values for the field may
be returned.
Correct behavior for `NULL` was difficult to decide, due to different
database handling of `NULL`. The current approach is based on lowest
common denominator behavior i.e. if one of the supported databases is
raising an error (rather than return `NULL`) for `val <op> NULL`, then
Django raises `FieldError`.
See also [https://github.com/django/django/pull/15271#issue-1091887189
Luke's description] for more details.
--
Ticket URL: <https://code.djangoproject.com/ticket/33397#comment:9>
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/0107017fdf21df1b-03cdf68f-1f29-4aa2-b49a-5381f61db944-000000%40eu-central-1.amazonses.com.