Hi, I've encountered a similar problems like Julien here: http://groups.google.com/group/django-users/browse_thread/thread/09e6d4f5c4f9cbfc
The case I have got is slightly more complex, and what is strange is that it doesn't seem to be fixed by Queryset Refactor branch merge (my django-trunk is revision 7871 from Jul-08 2008) To use Julien's example: model: from django.db import models from django.contrib.auth.models import User class Project(models.Model): name = models.CharField(max_length=200) created_by = models.ForeignKey(User) class Participant(models.Model): project = models.ForeignKey(Project) user = models.ForeignKey(User) First query: f1 = Project.objects.filter(created_by=user) f2 = Project.objects.filter(participant__user=user,name__startswith=name) projects = f1 | f2 Second query: q1 = Q(created_by=user) q2 = Q(participant__user=user,name__startswith=name) projects2 = Project.objects.filter(q1 | q2) I would think (and please correct me if I'm wrong) that these two queries should be the same, however when I have them printed out (like "str(projects.query)") they are not, the difference is one uses (correctly IMO) left outer join, the other one inner join: SELECT "play_project"."id", "play_project"."name", "play_project"."created_by_id" FROM "play_project" LEFT OUTER JOIN "play_participant" ON ("play_project"."id" = "play_participant"."project_id") WHERE ("play_project"."created_by_id" = AnonymousUser OR ("play_project"."name" LIKE xxx% ESCAPE '\' AND "play_participant"."user_id" = AnonymousUser )) SELECT "play_project"."id", "play_project"."name", "play_project"."created_by_id" FROM "play_project" INNER JOIN "play_participant" ON ("play_project"."id" = "play_participant"."project_id") WHERE ("play_project"."created_by_id" = AnonymousUser OR ("play_project"."name" LIKE xxx% ESCAPE '\' AND "play_participant"."user_id" = AnonymousUser )) Is this really incorrect or can somebody explain this? Should I open a ticket? (workaround of course is to go with the first query) Thank you, Ales --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com 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 -~----------~----~----~----~------~----~------~--~---