[Django] #25991: A new implementation for exclude() queries

19 views
Skip to first unread message

Django

unread,
Dec 28, 2015, 2:26:12 AM12/28/15
to django-...@googlegroups.com
#25991: A new implementation for exclude() queries
-------------------------------------+-------------------------------------
Reporter: akaariai | Owner: nobody
Type: Bug | Status: new
Component: Database | Version: master
layer (models, ORM) |
Severity: Normal | Keywords:
Triage Stage: Accepted | Has patch: 1
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
The idea is to prewalk the Q-object, split it into parts that need to go
into a subquery, and then add the filtered subqueries into the main query.

This ticket deals with problems of doing
`Author.objects.exclude(friends__age__gte=20, friends__age__lte=40)`.
Currently this creates two joins to friends, so that any author with
either a friend older than 20 or a friend younger than 40 is matched. The
correct interpretation is that any author with a friend with age between
20 and 40 is matched.

--
Ticket URL: <https://code.djangoproject.com/ticket/25991>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Dec 28, 2015, 2:45:23 AM12/28/15
to django-...@googlegroups.com
#25991: A new implementation for exclude() queries
-------------------------------------+-------------------------------------
Reporter: akaariai | Owner: nobody
Type: Bug | Status: new
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution:

Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by akaariai):

Related tickets:

- https://code.djangoproject.com/ticket/14645
- https://code.djangoproject.com/ticket/18726
- https://code.djangoproject.com/ticket/21703
- https://code.djangoproject.com/ticket/23797
- https://code.djangoproject.com/ticket/24386

The first one (#14645) deals with the issue mentioned in this ticket's
description. It should be fixed by this ticket. The rest of the tickets
are various failures in .exclude() queries, and these might be fixed by
this ticket, but I haven't verified those yet.

--
Ticket URL: <https://code.djangoproject.com/ticket/25991#comment:1>

Django

unread,
Dec 28, 2015, 3:34:50 AM12/28/15
to django-...@googlegroups.com
#25991: A new implementation for exclude() queries
-------------------------------------+-------------------------------------
Reporter: akaariai | Owner: nobody
Type: Bug | Status: new
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by CarstenF):

* cc: carsten.fuchs@… (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/25991#comment:2>

Django

unread,
Jan 1, 2016, 8:03:23 AM1/1/16
to django-...@googlegroups.com
#25991: A new implementation for exclude() queries
-------------------------------------+-------------------------------------
Reporter: akaariai | Owner: nobody
Type: Bug | Status: new
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by timgraham):

* needs_better_patch: 0 => 1


Comment:

As Ansii noted on the pull request, "I still found some cases that do not
work the way they should. So, this needs a bit more work...".

--
Ticket URL: <https://code.djangoproject.com/ticket/25991#comment:3>

Django

unread,
Mar 18, 2024, 3:15:14 AM3/18/24
to django-...@googlegroups.com
#25991: A new implementation for exclude() queries
-------------------------------------+-------------------------------------
Reporter: Anssi Kääriäinen | Owner: nobody
Type: Bug | Status: new
Component: Database layer | Version: dev
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Ülgen Sarıkavak):

* cc: Ülgen Sarıkavak (added)

--
Ticket URL: <https://code.djangoproject.com/ticket/25991#comment:4>

Django

unread,
May 19, 2025, 11:19:17 PM5/19/25
to django-...@googlegroups.com
#25991: A new implementation for exclude() queries
-------------------------------------+-------------------------------------
Reporter: Anssi Kääriäinen | Owner: Eddy
| ADEGNANDJOU
Type: Bug | Status: assigned
Component: Database layer | Version: dev
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Eddy ADEGNANDJOU):

* owner: nobody => Eddy ADEGNANDJOU
* status: new => assigned

--
Ticket URL: <https://code.djangoproject.com/ticket/25991#comment:5>
Reply all
Reply to author
Forward
0 new messages