Modified [7760] to not include a "col is not NULL" fragment for non-nullable fields.

This avoids any use of "pk is not NULL" fragment, which behave inconsistently
in MySQL. Thanks to Russell Keith-Magee for diagnosing the problem and
suggesting the easy fix.

Refs #7076.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@7812 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Malcolm Tredinnick 2008-07-01 10:12:50 +00:00
parent a75de3f342
commit 4fd359253d
1 changed files with 1 additions and 1 deletions

View File

@ -1131,7 +1131,7 @@ class Query(object):
entry.negate()
self.where.add(entry, AND)
break
elif not (lookup_type == 'in' and not value):
elif not (lookup_type == 'in' and not value) and field.null:
# Leaky abstraction artifact: We have to specifically
# exclude the "foo__in=[]" case from this handling, because
# it's short-circuited in the Where class.