#21787: Wrong SQL generated when using exclude() and model inheritance -------------------------------------+------------------------------------- Reporter: jmilner | Owner: nobody Type: Bug | Status: new Component: Database layer | Version: master (models, ORM) | Resolution: Severity: Normal | Triage Stage: Accepted Keywords: inheritance exclude | Needs documentation: 0 sql orm | Patch needs improvement: 0 Has patch: 0 | UI/UX: 0 Needs tests: 0 | Easy pickings: 0 | -------------------------------------+-------------------------------------
Comment (by akaariai): Proposed fix at https://github.com/akaariai/django/compare/ticket_21787. All tests pass and the failure mentioned in this ticket is now fixed. The names_to_path() method communicates joins generated for each name in path to split_exclude() (and split_exclude() communicates them further into trim_prefix()). In MTI situations names_to_path() didn't add parent table joins to the generated joins. Looking at the coding there is clear need of cleanup. Both the way joins per name are communicated to trim_prefix() and how trim_prefix() is coded are confusing. It is very hard to see if the coding in trim_prefix() is correct. I remember struggling a lot with trim_prefix() when working with split_exclude() changes. Seems like I need to continue that work later on. -- Ticket URL: <https://code.djangoproject.com/ticket/21787#comment:4> 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 django-updates+unsubscr...@googlegroups.com. To post to this group, send email to django-updates@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/065.bfbc9338f1fe185ef49e4fff0d3dbda2%40djangoproject.com. For more options, visit https://groups.google.com/groups/opt_out.