Opened 9 years ago

Last modified 9 months ago

#25991 new Bug

A new implementation for exclude() queries

Reported by: Anssi Kääriäinen Owned by: nobody
Component: Database layer (models, ORM) Version: dev
Severity: Normal Keywords:
Cc: carsten.fuchs@…, Ülgen Sarıkavak Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: yes
Easy pickings: no UI/UX: no

Description

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.

Change History (4)

comment:1 by Anssi Kääriäinen, 9 years ago

Related tickets:

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.

Version 0, edited 9 years ago by Anssi Kääriäinen (next)

comment:2 by Carsten Fuchs, 9 years ago

Cc: carsten.fuchs@… added

comment:3 by Tim Graham, 9 years ago

Patch needs improvement: set

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...".

comment:4 by Ülgen Sarıkavak, 9 months ago

Cc: Ülgen Sarıkavak added
Note: See TracTickets for help on using tickets.
Back to Top