Opened 12 years ago

Last modified 6 years ago

#19493 closed Bug

annotate(Count()) does not work properly with django.db.backends.oracle — at Initial Version

Reported by: kimvais@… Owned by: nobody
Component: Database layer (models, ORM) Version: 1.4
Severity: Normal Keywords: oracle
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

An QuerySet operation like:
models.SomeModel.objects.filter(somecharfield=value).values("someintegerfield").annotate(Count("someintegerfield"))

return a QuerySet with no aggregate count, but multiple rows with someintegerfieldcount=1

The correct SQL would be: SELECT tablespace_somemodel.someintegerfield,COUNT(tablespace_somemodel.someintegerfield) AS someintegerfieldcount FROM tablespace_somemodel WHERE tablespace_somemodel.somecharfield = 'value' GROUP BY tablespace_somemodel.someintegerfield;

This works fine on other backends.

Change History (0)

Note: See TracTickets for help on using tickets.
Back to Top