Changes between Initial Version and Version 1 of Ticket #33838
- Timestamp:
- Jul 11, 2022, 12:05:08 PM (2 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #33838 – Description
initial v1 34 34 <QuerySet [<Book: Book object (1)>, <Book: Book object (3)>]> 35 35 36 #Only returns one book where both foo__name and bar__name == 'Alex'36 #Only returns one book, expected to return all 3. 37 37 >>> Book.objects.filter(Q(foo__name='Alex') | Q(bar__name='Alex')) 38 38 <QuerySet [<Book: Book object (1)>]> … … 41 41 I 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`. 42 42 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 45 All 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.