Opened 5 years ago

Closed 5 years ago

Last modified 3 years ago

#12855 closed (fixed)

QuerySet.__or__ has bad behavior in the presence of extra

Reported by: Alex 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 5 years ago.

Download all attachments as: .zip

Change History (6)

comment:1 Changed 5 years ago by Alex

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

Changed 5 years ago by Alex

comment:2 Changed 5 years ago by Alex

  • Has patch set

comment:3 Changed 5 years ago by jbronn

  • Resolution set to fixed
  • Status changed from new to closed

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

comment:4 Changed 5 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 3 years ago by jacob

  • milestone 1.2 deleted

Milestone 1.2 deleted

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