#33257: Case() and ExpressionWrapper() doesn't work with DecimalField on SQLite.
-------------------------------------+-------------------------------------
Reporter: Matthijs Kooijman | Owner: Matthijs
| Kooijman
Type: Bug | Status: assigned
Component: Database layer | Version: dev
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Matthijs Kooijman):
> I agree with you analysis: When, WindowFrame, and OrderBy don't need
it.
Ok, I left those out.
> I'm not sure about Subquery, you can try to break it, but as far as I'm
aware it returns a single column/expression so casting to a numeric value
should be already handled there.
I tried, and could indeed not break Subquery.
Pullrequest is here: https://github.com/django/django/pull/15062
Regarding Case and ExpressionWrapper, I noticed a small difference between
them: ExpressionWrapper with output_field=DecimalField fails to convert a
non-decimal value to decimal (but works if the value is already a Decimal
literal or DecimalField), while Case actually breaks when applied to
existing decimal values (I suspect that sqlite does some type conversion
when executing the query). I now put both fixes in the same commit, if you
prefer separate commits, let me know.
--
Ticket URL: <https://code.djangoproject.com/ticket/33257#comment:5>
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/074.7936f715681bcaf7fbfa7a92c515b136%40djangoproject.com.