#27849: Support Postgres FILTER WHERE conditions in ArrayAgg
--------------------------------------------+------------------------
Reporter: Tom | Owner: (none)
Type: New feature | Status: new
Component: contrib.postgres | Version: master
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
--------------------------------------------+------------------------
In some circumstances being able to filter results included in an ArrayAgg
is needed. PostgreSQL supports this through the FILTER WHERE clause:
{{{
SELECT ARRAY_AGG(id) FILTER (WHERE id < 10) as foo FROM table
}}}
Adding support for Q expressions in the ArrayAgg class could provide this
functionality, i.e:
{{{
SomeModel.objects.annotate(foo=ArrayAgg('some_relation__id',
where=Q(some_relation__bar=10)))
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/27849>
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 post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/046.b6944afa815c68a6dd1bb9572aa4f3a2%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.