#29229: QuerySet.values_list() combined with .extra() or .annotate() may produce
wrong .union()
-------------------------------------+-------------------------------------
     Reporter:  master               |                    Owner:  nobody
         Type:  Bug                  |                   Status:  closed
    Component:  Database layer       |                  Version:  1.11
  (models, ORM)                      |
     Severity:  Release blocker      |               Resolution:  fixed
     Keywords:  union values_list    |             Triage Stage:  Ready for
                                     |  checkin
    Has patch:  1                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by master):

 The regression test added by the PR
 (test_union_with_two_annotated_values_list()) seems to have an
 unnecessarily complex combination, just to comply with a mandatory
 ordering of fields imposed by the union.
 Instead of:

 {{{
 .annotate(count=F('num'),).annotate(num=Value(1, IntegerField()),
 }}}
 This writing is more understandable:

 {{{
 .annotate(num=F('num'),).annotate(count=Value(1, IntegerField()),
 }}}

-- 
Ticket URL: <https://code.djangoproject.com/ticket/29229#comment:8>
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/064.6b5380dc4604a2afcc76c0a6b34d2c14%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to