Changes between Initial Version and Version 1 of Ticket #33838


Ignore:
Timestamp:
Jul 11, 2022, 12:05:08 PM (2 years ago)
Author:
Alex Bailey
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #33838 – Description

    initial v1  
    3434<QuerySet [<Book: Book object (1)>, <Book: Book object (3)>]>
    3535
    36 #Only returns one book where both foo__name and bar__name == 'Alex'
     36#Only returns one book, expected to return all 3.
    3737>>> Book.objects.filter(Q(foo__name='Alex') | Q(bar__name='Alex'))
    3838<QuerySet [<Book: Book object (1)>]>
     
    4141I am working with an existing DB where it is possible for a `Person` to no longer exist, hence the lack of `db_constraint` in the `ForeignKey`.
    4242
    43 `Books` can refer to non-existent `Persons` but it still seems like expected behavior would be for the queryset OR to return all 3 books. I believe this is coming from the Django ORM doing an INNER JOIN.
     43`Books` can refer to non-existent `Persons` but it still seems like expected behavior would be for the queryset OR to return all 3 books. I believe this is coming from the Django ORM doing an INNER JOIN. The 3rd query should be a simple union of the first 2 queries.
     44
     45All 3 books fit into the expected query of `books WHERE foo__name = 'Alex' OR  bar__name = 'Alex'` but the Django behavior does not reflect this.
Back to Top