#29315: exclude with OneToOneField produces incorrect results on sqlite
-------------------------------------+-------------------------------------
               Reporter:             |          Owner:  nobody
  RaphaelKimmig                      |
                   Type:  Bug        |         Status:  new
              Component:  Database   |        Version:  2.0
  layer (models, ORM)                |
               Severity:  Normal     |       Keywords:
           Triage Stage:             |      Has patch:  0
  Unreviewed                         |
    Needs documentation:  0          |    Needs tests:  0
Patch needs improvement:  0          |  Easy pickings:  0
                  UI/UX:  0          |
-------------------------------------+-------------------------------------
 When excluding instances where the related model has a certain field value
 instances where no related model exists are excluded as well. This happens
 with sqlite 3.16.2 on mac os.

 Using postgresql with psycopg2 I was unable to reproduce the issue.

 {{{
 from django.db import models


 class A(models.Model):
     pass


 class B(models.Model):
     a = models.OneToOneField(A)
     value = models.IntegerField()


 def test():
     A.objects.all().delete()
     B.objects.all().delete()

     A.objects.create()
     assert A.objects.exclude(b__value=12345).count() == 1, "We expect to
 get one A but got zero."
 }}}

-- 
Ticket URL: <https://code.djangoproject.com/ticket/29315>
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/056.6bed1e63903bc00d56f719cefaa1ff1a%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to