#28553: Querysets: annotate() columns are forced into a certain position which may disrupt union() -------------------------------------+------------------------------------- Reporter: David Sanders | Owner: nobody Type: Bug | Status: new Component: Database layer | Version: 1.11 (models, ORM) | Severity: Normal | Resolution: Keywords: | Triage Stage: Accepted Has patch: 0 | Needs documentation: 0 Needs tests: 0 | Patch needs improvement: 0 Easy pickings: 0 | UI/UX: 0 -------------------------------------+------------------------------------- Changes (by Ole Laursen):
* cc: Ole Laursen (added) * type: Cleanup/optimization => Bug Comment: There's a ticket with a test case in #30211. That ticket was reported as a bug, and I think this ticket should be a bug too, so I'm changing the classification for now (apologies if that's inappropriate). I think it's a bug because the documentation in my reading implies that as long as the columns match, union will work. So it really comes as a bit of a surprise that Django overrides the order in values_list(). In my particular case, I'm using union() to combine two different tables that I need to get out in sorted order, and I was trying to use annotate() + values_list() to add a NULL filler to one table as it lacks a column from the other. Also, I suppose the ORM could possibly also be a bit more efficient if it could return values_list() tuples directly from the select instead of having to rearrange them? -- Ticket URL: <https://code.djangoproject.com/ticket/28553#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/066.287d3e434ba58b46a28d7867bbab79e3%40djangoproject.com. For more options, visit https://groups.google.com/d/optout.