Changes between Initial Version and Version 1 of Ticket #18583, comment 2
- Timestamp:
- Feb 23, 2013, 3:43:09 PM (12 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #18583, comment 2
initial v1 2 2 3 3 Given this full example: 4 4 {{{ 5 5 #models 6 6 from django.utils.encoding import python_2_unicode_compatible … … 37 37 def __str__(self): 38 38 return str(self.pk) 39 }}} 39 40 40 41 The following query: 41 42 42 C.objects.exclude(b__a__d__group__in=[foo]).order_by('pk')43 {{{ C.objects.exclude(b__a__d__group__in=[foo]).order_by('pk') }}} 43 44 44 45 Results in: 45 46 {{{ 46 47 SELECT "queries_c"."id", "queries_c"."b_id" FROM "queries_c" 47 48 INNER JOIN "queries_b" ON ("queries_c"."b_id" = "queries_b"."id") … … 49 50 (SELECT U3."a_id" FROM "queries_d" U3 WHERE U3."group_id" IN (1)) 50 51 AND "queries_b"."a_id" IS NOT NULL)) 52 }}} 51 53 52 54 Which is correct, as the filtering is taken to the a.id field (see the inner SELECT).