Django

Code

Ticket #7096 (closed: fixed)

Opened 7 months ago

Last modified 7 months ago

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

Reported by: oyvind Assigned to: nobody
Milestone: Component: Database layer (models, ORM)
Version: SVN Keywords: exclude in not
Cc: Triage Stage: Accepted
Has patch: 0 Needs documentation: 0
Needs tests: 1 Patch needs improvement: 0

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')

Attachments

Change History

04/27/08 21:57:38 changed by SmileyChris

  • needs_better_patch changed.
  • stage changed from Unreviewed to Accepted.
  • needs_tests set to 1.
  • needs_docs changed.

I can confirm this bug, just recreated.

04/27/08 22:07:27 changed 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.

04/27/08 23:29:06 changed by mtredinnick

  • status changed from new to closed.
  • resolution set to fixed.

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


Add/Change #7096 (incorrect SQL generated for queryset multiple argument .exclude() calls)




Change Properties
Action