Opened 7 years ago

Closed 7 years ago

#7096 closed (fixed)

incorrect SQL generated for queryset multiple argument .exclude() calls

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

Description

Model.objects.exclude(afield__in=[1,2], somefield__exact='something')

yields wrong sql

NOT (NOT afield in (1,2) AND somefield LIKE 'something')

Should be

NOT (afield in (1,2) AND somefield LIKE 'something')

Change History (3)

comment:1 Changed 7 years ago by SmileyChris

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

I can confirm this bug, just recreated.

comment:2 Changed 7 years ago by SmileyChris

  • Summary changed from problems with exclude and __in queries after queryset refactor merge to incorrect SQL generated for queryset multiple argument .exclude() calls

More testing shows that it's not a problem with __in, but any multiple argument exclude call.

comment:3 Changed 7 years ago by mtredinnick

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

(In [7493]) Fixed #7096 -- The simplifications in [7461] weren't complete. They broke
multi-component exclude() calls. Fixed that.

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