On Mon, 2008-02-11 at 01:03 -0800, Julien wrote:
> Hi,
> 
> Here's the SQL code:
> 
> SELECT
> `projects_project`.`id`,`projects_project`.`name`,`projects_project`.`created_by_id`,
> FROM `projects_project` INNER JOIN `projects_participant` AS
> `projects_project__participants`
> ON `projects_project`.`id` =
> `projects_project__participants`.`project_id`
> WHERE ((`projects_project`.`created_by_id` = 1 OR
> `projects_project__participants`.`user_id` = 1))

Since the link from Project to Participants (in that direction) can be
empty, the join there should really be a LEFT OUTER join. This is one of
those bugs that occurs with "or" joins sometimes and is one of the
reason they've been heavily rewritten on the queryset-refactor branch.
Basically, if one of the querysets could be empty when there are results
in the other queryset, you sometimes see problems. This is one of those
cases.

All I can suggest is waiting a little while until queryset-refacotor is
merged into trunk (if you're really brave, you could try running against
the branch, but I haven't really declared it ready for testing yet). In
the meantime, pull the two querysets back into Python and merge the
lists there. Unless you're pulling back hundreds of thousands of
results, you won't notice any real speed difference.

Regards,
Malcolm

-- 
Depression is merely anger without enthusiasm. 
http://www.pointy-stick.com/blog/


--~--~---------~--~----~------------~-------~--~----~
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