#34450: Lookup expressions across foreign keys introduce extra joins
-------------------------------------+-------------------------------------
     Reporter:  Roman Odaisky        |                    Owner:  Simon
                                     |  Charette
         Type:  Bug                  |                   Status:  assigned
    Component:  Database layer       |                  Version:  4.1
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:
     Keywords:                       |             Triage Stage:  Accepted
    Has patch:  1                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by David Sanders):

 Just FYI Simon's patch resolves the reported issue:

 {{{
 > print(Parent.objects.filter(Exact(F("child__x"), "x"),
 child__y="y").query)

 SELECT "ticket_34450_parent"."id" FROM "ticket_34450_parent" INNER JOIN
 "ticket_34450_child" ON ("ticket_34450_parent"."id" =
 "ticket_34450_child"."parent_id") WHERE ("ticket_34450_child"."x" = (x)
 AND "ticket_34450_child"."y" = y)
 }}}

-- 
Ticket URL: <https://code.djangoproject.com/ticket/34450#comment:11>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/010701873c7df679-9122aabc-b117-4285-b179-8dbe26647851-000000%40eu-central-1.amazonses.com.

Reply via email to