From 4fd359253d6538c6c418d23153ddb57cb1a48d17 Mon Sep 17 00:00:00 2001 From: Malcolm Tredinnick Date: Tue, 1 Jul 2008 10:12:50 +0000 Subject: [PATCH] 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 --- django/db/models/sql/query.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/django/db/models/sql/query.py b/django/db/models/sql/query.py index 6c06609969..6eccaf997e 100644 --- a/django/db/models/sql/query.py +++ b/django/db/models/sql/query.py @@ -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.