#23557: annotate gives different results on postgresql and mysql -------------------------------------+------------------------------------- Reporter: brian | Owner: nobody Type: Bug | Status: new Component: Database layer | Version: 1.7 (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 jarshwah):
* needs_better_patch: => 0 * needs_tests: => 0 * needs_docs: => 0 Comment: The behaviour you're seeing with Postgres is correct, and documented: https://docs.djangoproject.com/en/dev/topics/db/aggregation/#interaction- with-default-ordering-or-order-by Columns in the ORDER BY clause must be added to the GROUP BY clause on Postgres, and any RDBMS that conforms to the spec. MySQL and sqlite allow columns in the select list that aren't also in the GROUP BY. Django should be consistent though - it's weird that different results are returned based on the underlying engine. I would propose that the MySQL backend should add the order by columns into the group by list. -- Ticket URL: <https://code.djangoproject.com/ticket/23557#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 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/063.28507bf31f38ecb12149d08153a0c680%40djangoproject.com. For more options, visit https://groups.google.com/d/optout.