#18726: Combination of F() expression with query seems to confuse sql compiler's table aliases -------------------------------------+------------------------------------- Reporter: bugs@… | Owner: nobody Type: Bug | Status: reopened Component: Database layer | Version: 1.4 (models, ORM) | Resolution: Severity: Normal | Triage Stage: Keywords: | Unreviewed Has patch: 0 | Needs documentation: 0 Needs tests: 0 | Patch needs improvement: 0 Easy pickings: 0 | UI/UX: 0 -------------------------------------+------------------------------------- Changes (by bugs@…):
* status: closed => reopened * resolution: needsinfo => Comment: Ok here we are - a models.py that causes the problem: {{{#!python from django.db import models class ModelC ( models.Model ): pass class ModelB ( models.Model ): m2m_field_q = models.ManyToManyField ( ModelC ) class ModelA ( models.Model ): m2m_field_r = models.ManyToManyField ( ModelB ) class ModelY ( models.Model ): fk_field_s = models.ForeignKey ( ModelC ) class ModelX ( models.Model ): fk_field_t = models.ForeignKey ( ModelY ) m2m_field_u = models.ManyToManyField ( ModelA , through = "ModelXThroughA" ) class ModelXThroughA ( models.Model ): fk_field_v = models.ForeignKey ( ModelX ) fk_field_w = models.ForeignKey ( ModelA ) }}} which upon running: {{{#!python ModelXThroughA.objects.exclude ( fk_field_w__m2m_field_r__m2m_field_q = F ( "fk_field_v__fk_field_t__fk_field_s" ) ) }}} results in: {{{ DatabaseError: missing FROM-clause entry for table "u4" LINE 1: ...id") INNER JOIN "dummy_modela_m2m_field_r" U5 ON (U4."id" = ... }}} -- Ticket URL: <https://code.djangoproject.com/ticket/18726#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 post to this group, send email to django-updates@googlegroups.com. To unsubscribe from this group, send email to django-updates+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.