#28727: sqlite: CAST to DATE causes error
-------------------------------------+-------------------------------------
     Reporter:  direx                |                    Owner:  nobody
         Type:  Bug                  |                   Status:  new
    Component:  Database layer       |                  Version:  master
  (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 direx):

 Replying to [comment:4 Simon Charette]:
 > I managed to reproduce locally but I'm not sure what the resolution
 should be here. I feel like this is an abuse of the `Cast` function as it
 wasn't meant to be used with Python primitives, `Value` should be used
 instead.

 In the Django docs it is expicitely stated that `Cast` is required in
 combination with Python types and `Coalesce`. It says:

 ''A Python value passed to Coalesce on MySQL may be converted to an
 incorrect type unless explicitly cast to the correct database type''

 See the example right here:

 https://docs.djangoproject.com/en/1.11/ref/models/database-
 functions/#coalesce

 The code in the given example does not work on SQLite and triggers this
 very bug, so I think this is a valid issue for all current Django
 versions.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/28727#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 post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/063.168de2a524d3d7bec20f0909b48e9c89%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to