#23803: DateField returns datetime if SQLite field is created as TIMESTAMP
-------------------------------------+-------------------------------------
     Reporter:  me21                 |                    Owner:  nobody
         Type:  Bug                  |                   Status:  closed
    Component:  Database layer       |                  Version:  master
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:  wontfix
     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 aaugustin):

 You're merely seeing the consequences of SQLite's loose typing system. The
 type of a value is only determined by inspecting the value.

 You wouldn't notice it if the database was managed by Django because the
 database would never contain values that don't cast to the correct type.

 Perhaps django-pyodbc-azure performs a cast in that case, however, we
 don't want to do that in Django because that's a performance critical code
 path.

 Interacting with external databases -- i.e. databases not created by
 Django -- requires mapping columns according to their type. Here you have
 a column containing datetimes. You must map it to a DateTimeField. That's
 all.

 You can't alter the type of a column, putting the database schema out of
 sync with Django's model definition, and expect things to keep working.

--
Ticket URL: <https://code.djangoproject.com/ticket/23803#comment:4>
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/062.3f98aeca371a62f00622e249c0f58193%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to