#34945: annotate -> union -> values gives wrong values
-------------------------------------+-------------------------------------
     Reporter:  Tom Carrick          |                    Owner:  nobody
         Type:  Bug                  |                   Status:  new
    Component:  Database layer       |                  Version:  4.2
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:
     Keywords:                       |             Triage Stage:
                                     |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by David Sanders):

 Duplicate of #28900? 🤔

 I've managed to boil this down the following example:

 {{{
 class Foo(Model):
     name = CharField()

 class Bar(Model):
     name = CharField()

 qs = (
     Foo.objects.annotate(alias=F("name"))
     .union(Bar.objects.annotate(alias=F("name")))
     .values("alias")
 )
 print(qs)
 }}}

 gives

 {{{
 <QuerySet [{'alias': 1}, {'alias': 1}]>
 }}}

-- 
Ticket URL: <https://code.djangoproject.com/ticket/34945#comment:1>
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/0107018b9fbc3dce-48427a22-66c1-49da-92bb-b346305e4a7f-000000%40eu-central-1.amazonses.com.

Reply via email to