[Django] #32546: Meta.ordering fields must not be included in GROUP BY clause

2 views
Skip to first unread message

Django

unread,
Mar 13, 2021, 4:06:23 PM3/13/21
to django-...@googlegroups.com
#32546: Meta.ordering fields must not be included in GROUP BY clause
-------------------------------------+-------------------------------------
Reporter: Yuri | Owner: nobody
Konotopov |
Type: Bug | Status: new
Component: Database | Version: 3.1
layer (models, ORM) |
Severity: Normal | Keywords:
Triage Stage: | Has patch: 1
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
This continues (closed) ![1] ticket.

I beleave it was not properly fixed in commit [0ddb4ebf].
While commit [0ddb4ebf] removes ORDER BY when Meta.ordering is used it
still does populates GROUP BY with Meta.ordering fields thus leads to
wrong aggregation.
PR with test case was added at ![2].


[1] https://code.djangoproject.com/ticket/14357
[2] ​https://github.com/django/django/pull/14122

--
Ticket URL: <https://code.djangoproject.com/ticket/32546>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Mar 15, 2021, 5:55:22 AM3/15/21
to django-...@googlegroups.com
#32546: Meta.ordering fields must not be included in GROUP BY clause
-------------------------------------+-------------------------------------
Reporter: Yuri Konotopov | Owner: Yuri
| Konotopov
Type: Bug | Status: assigned
Component: Database layer | Version: 3.1
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

* status: new => assigned
* cc: Simon Charette (added)
* needs_better_patch: 0 => 1
* needs_tests: 0 => 1
* owner: nobody => Yuri Konotopov
* stage: Unreviewed => Accepted


--
Ticket URL: <https://code.djangoproject.com/ticket/32546#comment:1>

Django

unread,
Mar 15, 2021, 6:38:31 AM3/15/21
to django-...@googlegroups.com
#32546: Meta.ordering fields must not be included in GROUP BY clause
-------------------------------------+-------------------------------------
Reporter: Yuri Konotopov | Owner: Yuri
| Konotopov
Type: Bug | Status: assigned
Component: Database layer | Version: 3.1
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

* needs_tests: 1 => 0


--
Ticket URL: <https://code.djangoproject.com/ticket/32546#comment:2>

Django

unread,
Mar 15, 2021, 3:18:35 PM3/15/21
to django-...@googlegroups.com
#32546: Meta.ordering fields must not be included in GROUP BY clause
-------------------------------------+-------------------------------------
Reporter: Yuri Konotopov | Owner: Yuri
| Konotopov
Type: Bug | Status: assigned
Component: Database layer | Version: 3.1
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

* needs_better_patch: 1 => 0
* stage: Accepted => Ready for checkin


--
Ticket URL: <https://code.djangoproject.com/ticket/32546#comment:3>

Django

unread,
Mar 16, 2021, 3:33:12 AM3/16/21
to django-...@googlegroups.com
#32546: Meta.ordering fields must not be included in GROUP BY clause
-------------------------------------+-------------------------------------
Reporter: Yuri Konotopov | Owner: Yuri
| Konotopov
Type: Bug | Status: closed

Component: Database layer | Version: 3.1
(models, ORM) |
Severity: Normal | Resolution: fixed

Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak <felisiak.mariusz@…>):

* status: assigned => closed
* resolution: => fixed


Comment:

In [changeset:"330bc402a8d2d8f23cf2e07d9dabf333003677d3" 330bc40]:
{{{
#!CommitTicketReference repository=""
revision="330bc402a8d2d8f23cf2e07d9dabf333003677d3"
Fixed #32546 -- Avoided Meta.ordering columns in GROUP BY clauses.

Follow up to 0ddb4ebf7bfcc4730c80a772dd146a49ef6895f6.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/32546#comment:4>

Reply all
Reply to author
Forward
0 new messages