#30771: Filtering on query result overrides GROUP BY of internal query
-------------------------------------+-------------------------------------
Reporter: Aur Saraf | Owner: James
| Timmins
Type: Bug | Status: assigned
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution:
Keywords: annotate, | Triage Stage: Accepted
annotation, filter, groupby, |
aggregate, aggregation |
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by James Timmins):
Mmm actually disregard that. The second value in the `GROUP BY` is due to
the `ordering` value in the Author class's Meta class.
{{{
class Author(models.Model):
name = models.CharField(max_length=100)
alias = models.CharField(max_length=50, null=True, blank=True)
class Meta:
ordering = ('name',)
}}}
Regarding the bug in question in this ticket, what should the desired
behavior be if the inner query is returning multiple fields? With the fix,
which allows the inner query to define a field to return/group by, if
there are multiple fields used then it will throw a
`sqlite3.OperationalError: row value misused`.
Is this the desired behavior or should it avoid this problem by defaulting
back to `pk` if more than one field is selected?
--
Ticket URL: <https://code.djangoproject.com/ticket/30771#comment:7>
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/068.e4a10cd5c66eb68fd416435d0cbc1444%40djangoproject.com.