Opened 7 years ago

Closed 7 years ago

Last modified 5 years ago

#12855 closed (fixed)

QuerySet.__or__ has bad behavior in the presence of extra

Reported by: Alex Gaynor Owned by: nobody
Component: Database layer (models, ORM) Version: master
Severity: Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

If you do something like

    q = Model.objects.extra(where=["some stuff"]) | Model.objects.filter(c=d)

In this csae the where clause of the 2nd queryset gets lost because of the way they are combined. This is a symptom of the fact that extra where stuff is basically tacked onto the end of a queryset after the fact.

Attachments (1)

django-extra-where.diff (5.4 KB) - added by Alex Gaynor 7 years ago.

Download all attachments as: .zip

Change History (6)

comment:1 Changed 7 years ago by Alex Gaynor

Needs documentation: unset
Needs tests: unset
Patch needs improvement: unset
Triage Stage: UnreviewedAccepted

Changed 7 years ago by Alex Gaynor

Attachment: django-extra-where.diff added

comment:2 Changed 7 years ago by Alex Gaynor

Has patch: set

comment:3 Changed 7 years ago by jbronn

Resolution: fixed
Status: newclosed

(In [12502]) Fixed #12855 -- QuerySets with extra where parameters now combine correctly. Thanks, Alex Gaynor.

comment:4 Changed 7 years ago by jbronn

(In [12507]) Fixed #12855 -- QuerySets? with extra where parameters now combine correctly. Thanks, Alex Gaynor.

Backport of r12502 from trunk.

comment:5 Changed 5 years ago by Jacob

milestone: 1.2

Milestone 1.2 deleted

Note: See TracTickets for help on using tickets.
Back to Top