#30224: Mysql Datetime value is string instead of datetime object
-------------------------------------+-------------------------------------
     Reporter:  Martin Kuhn          |                    Owner:  nobody
         Type:  Bug                  |                   Status:  new
    Component:  Database layer       |                  Version:  2.2
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:
     Keywords:  Mysql                |             Triage Stage:  Accepted
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by Martin Kuhn):

 The problem seems to be Aggregation functions have a beef with Datetime in
 general. They convert them into a string. :(
 So truly the best workaround would be to Wrap these functions with a CAST
 operation.

 {{{
 c.execute(""" SELECT MIN(CAST('2018-01-01 00:00:00' AS datetime)); """)
 1
 c.fetchall()[0][0]
 '2018-01-01 00:00:00'

 }}}

 By the way mysqlclient's response was "The answer is noooo!" Defiantly not
 their problem.

 We could ask Mysql to fix it, but the same seems to be the case for
 mariaDB. I experimented with different MySql flavours and versions, before
 opening this bug.  That means a improvement on the server would probably
 be around 2055.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/30224#comment:11>
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/065.11e72153e0087ffcc2f1ad0a685925a6%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to