#10032: ORM switches incorrectly to OUTER JOIN in certain cases with isnull=True
---------------------------------------------------+------------------------
Reporter: gabor | Owner: nobody
Status: closed | Milestone: 1.1
Component: Database layer (models, ORM) | Version: 1.0
Resolution: invalid | Keywords:
Stage: Accepted | Has_patch: 0
Needs_docs: 0 | Needs_tests: 0
Needs_better_patch: 0 |
---------------------------------------------------+------------------------
Changes (by mtredinnick):
* status: new => closed
* resolution: => invalid
Comment:
There's no way for Django to read the user's mind here and there are two
quite acceptable ways to interpret that filter. Django has chosen one way
(which matches the fairly natural way the equivalent SQL query might fall
out). You have chosen the other way. Unfortunately we can't have both.
You will need to write your query as
{{{
#!python
Group.objects.filter(person__stamp__isnull=True, person__isnul=False)
}}}
or, similarly,
{{{
#!python
Group.objects.exclude(person=None).filter(person__stamp=None)
}}}
etc.
The current behaviour isn't "incorrect". It's an interpretation of an
ambiguous situation and we're very consistent about how that
interpretation is applied. If you'd like to propose a documentation
clarification, that would be worth looking at.
--
Ticket URL: <http://code.djangoproject.com/ticket/10032#comment:2>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---