#26324: DurationField stores certain values incorrectly in sqlite
----------------------------------------------+----------------------------
     Reporter:  chausner                      |      Owner:  nobody
         Type:  Bug                           |     Status:  new
    Component:  Database layer (models, ORM)  |    Version:  1.9
     Severity:  Normal                        |   Keywords:  sqlite,
                                              |  DurationField
 Triage Stage:  Unreviewed                    |  Has patch:  0
Easy pickings:  0                             |      UI/UX:  0
----------------------------------------------+----------------------------
 When encoding certain timedelta values in a DurationField, saving the
 object to a sqlite database and then reading it again, DurationField
 returns None.
 {{{#!python
 class Foo(models.Model):
     bar = models.DurationField()

 Foo.objects.create(bar=timedelta(seconds=2.05))
 Foo.objects.create(bar=timedelta(seconds=3.05))

 print str(Foo.objects.all()[0].length) # 'None'
 print str(Foo.objects.all()[1].length) # '3.05'
 }}}
 I can reproduce this bug with Django 1.8.5 and 1.9.3 using sqlite as
 database backend. It does not occur with MySQL, so it seems to be related
 to how sqlite stores bigints. It renders DurationField essentially useless
 with sqlite.

--
Ticket URL: <https://code.djangoproject.com/ticket/26324>
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/051.7af9d75f6838ebfb3283e7d6a2b59ae5%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to