#33766: FilteredRelation resolves its conditions too late which can result in
unknown alias references at SQL compilation time
-------------------------------------+-------------------------------------
     Reporter:  Daniel Schaffer      |                    Owner:  nobody
         Type:  Bug                  |                   Status:  new
    Component:  Database layer       |                  Version:  3.2
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:
     Keywords:  filteredrelation     |             Triage Stage:  Accepted
  coalesce                           |
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by zhu):

 The FilteredRelation cannot resolve itself too.

 {{{
     def test_ref_self_in_condition(self):
         self.assertSequenceEqual(
             Author.objects.annotate(
                 the_book=FilteredRelation(
                     "book",
                     condition=Q(
                         name=F('book__title'),
                         ),
                 ),
             )
             .filter(
                 the_book__isnull=False,
             ),
             [],
         )

 }}}

-- 
Ticket URL: <https://code.djangoproject.com/ticket/33766#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/0107018672e3d138-87859274-7050-4ec0-bb30-d24a1311d9a2-000000%40eu-central-1.amazonses.com.

Reply via email to