#32525: Class Cast throws DataError when column contains numeric string or
alphabet
string in postgres
-------------------------------------+-------------------------------------
Reporter: kygoh | Owner: nobody
Type: New feature | Status: closed
Component: Database layer | Version: 3.0
(models, ORM) |
Severity: Normal | Resolution: wontfix
Keywords: QuerySet.extra | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Mariusz Felisiak):
Also, you don't need to use `extra()` you can use a custom function (if it
already exists in your db):
{{{
class CastToNumeric(Func):
function = 'cast_to_numeric'
output_field = FloatField()
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/32525#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/063.8577b2d8041e084e848bb7b037b1e693%40djangoproject.com.