#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 kygoh):

 Replying to [comment:5 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()
 > }}}

 Pardon my ignorance for reopening closed tickets. This suggestion is
 indeed of great help. Thank you.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/32525#comment:6>
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.f6b33bfe4b68283f018239d48f7a9c54%40djangoproject.com.

Reply via email to