Alex,

First I made a mistake in the original post. The first query returns
*nothing*, not "all places". This is the correct "question:

1) print Place.objects.filter(restaurant__isnull=True).count()

returns 0

and 2) print Place.objects.filter
(restaurant__serves_hotdog__isnull=True).count()

works correctly, returning a count of all Places that is not a
restaurant.


The first query does not even join the child table. It tries to do:

SELECT COUNT(*) FROM "place" WHERE "place"."id" IS NULL

Where as the second query does a LEFT OUTER JOIN between parent and
child table, then
added a where clause to test for the hotdog field being null,
essentially filtered out the rows
that have no hotdog fields at all.

Seems like query 1 is broken?

P.K.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" 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-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to