#11293: Filters on aggregates lose connector
-------------------------------------+-------------------------------------
Reporter: django@… | Owner: -
Type: Bug | Status: reopened
Component: ORM aggregation | Version: 1.4
Severity: Normal | Resolution:
Keywords: having, where, | Triage Stage: Accepted
aggregate, connector | Needs documentation: 0
Has patch: 1 | Patch needs improvement: 0
Needs tests: 0 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------
Changes (by akaariai):
* needs_better_patch: 1 => 0
Comment:
I tested the above with
https://github.com/akaariai/django/tree/refactor_utils_tree and that patch
seems to solve this issue.
This is the SQL query I get:
{{{
SELECT "auth_user"."id", "auth_user"."username", "auth_user"."first_name",
"auth_user"."last_name", "auth_user"."email", "auth_user"."password",
"auth_user"."is_staff", "auth_user"."is_active",
"auth_user"."is_superuser", "auth_user"."last_login",
"auth_user"."date_joined", COUNT("auth_user_groups"."group_id") AS
"groups__count" FROM "auth_user" LEFT OUTER JOIN "auth_user_groups" ON
("auth_user"."id" = "auth_user_groups"."user_id") GROUP BY
"auth_user"."id", "auth_user"."username", "auth_user"."first_name",
"auth_user"."last_name", "auth_user"."email", "auth_user"."password",
"auth_user"."is_staff", "auth_user"."is_active",
"auth_user"."is_superuser", "auth_user"."last_login",
"auth_user"."date_joined" HAVING ("auth_user"."username" = tim OR
COUNT("auth_user_groups"."group_id") > 1 )
}}}
I can't test if I get the correct results, as I don't have the test data
available. But the query looks correct to me.
--
Ticket URL: <https://code.djangoproject.com/ticket/11293#comment:22>
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 post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en.