[Django] #29317: filter keyword undocumented in PostgreSQL aggregate functions

8 views
Skip to first unread message

Django

unread,
Apr 11, 2018, 12:35:47 PM4/11/18
to django-...@googlegroups.com
#29317: filter keyword undocumented in PostgreSQL aggregate functions
-------------------------------------+-------------------------------------
Reporter: Matthew | Owner: nobody
Pava |
Type: | Status: new
Cleanup/optimization |
Component: | Version:
Documentation |
Severity: Normal | Keywords: aggregate
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
The signature for all of the aggregate functions for PostgreSQL includes a
`filter` keyword argument, but I can't figure out what it is used for
based on the documentation alone:
[https://docs.djangoproject.com/en/2.0/ref/contrib/postgres/aggregates/].

For what it's worth, I'm trying to filter out all of the empty values in
an `ArrayAgg` expression, which seems to be a fairly common thing that one
would want to do. Perhaps we could add an example to the documentation
showing how that can be accomplished. I'm not sure right now if the
`filter` keyword argument is the way to go.

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

Django

unread,
Apr 11, 2018, 12:56:25 PM4/11/18
to django-...@googlegroups.com
#29317: filter keyword undocumented in PostgreSQL aggregate functions
-------------------------------------+-------------------------------------
Reporter: Matthew Pava | Owner: nobody
Type: | Status: new
Cleanup/optimization |
Component: Documentation | Version:
Severity: Normal | Resolution:
Keywords: aggregate | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Tim Graham):

The relevant commit is b78d100fa62cd4fbbc70f2bae77c192cb36c1ccd. I don't
think it makes much sense to repeat the documentation for `filter` in
every aggregate subclass. Ideas?

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

Django

unread,
Apr 11, 2018, 1:06:50 PM4/11/18
to django-...@googlegroups.com
#29317: filter keyword undocumented in PostgreSQL aggregate functions
-------------------------------------+-------------------------------------
Reporter: Matthew Pava | Owner: nobody
Type: | Status: new
Cleanup/optimization |

Component: Documentation | Version:
Severity: Normal | Resolution:
Keywords: aggregate | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Matthew Pava):

I agree. I just found the documentation here:
https://docs.djangoproject.com/en/2.0/topics/db/aggregation/#filtering-on-
annotations
Honestly, though, even that little note seems a little buried in
everything.

Maybe we can add a link to the generic aggregation documentation on the
PostgreSQL aggregation documentation?
And, I think I found a bug. I keep getting this error when using a filter
`Q` object with `ArrayAgg`:
`AttributeError: 'WhereNode' object has no attribute
'_output_field_or_none'`

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

Django

unread,
Apr 16, 2018, 2:29:35 PM4/16/18
to django-...@googlegroups.com
#29317: filter keyword undocumented in PostgreSQL aggregate functions
--------------------------------------+------------------------------------

Reporter: Matthew Pava | Owner: nobody
Type: Cleanup/optimization | Status: new

Component: Documentation | Version:
Severity: Normal | Resolution:
Keywords: aggregate | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0

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

* stage: Unreviewed => Accepted


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

Django

unread,
May 7, 2018, 4:18:13 PM5/7/18
to django-...@googlegroups.com
#29317: filter keyword undocumented in PostgreSQL aggregate functions
--------------------------------------+------------------------------------
Reporter: Matthew Pava | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Documentation | Version:
Severity: Normal | Resolution:
Keywords: aggregate | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0

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

* cc: Tom Forbes (added)


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

Django

unread,
Oct 18, 2018, 7:05:53 PM10/18/18
to django-...@googlegroups.com
#29317: filter keyword undocumented in PostgreSQL aggregate functions
--------------------------------------+------------------------------------
Reporter: Matthew Pava | Owner: shalgrim
Type: Cleanup/optimization | Status: assigned

Component: Documentation | Version:
Severity: Normal | Resolution:
Keywords: aggregate | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0

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

* owner: nobody => shalgrim
* status: new => assigned


--
Ticket URL: <https://code.djangoproject.com/ticket/29317#comment:5>

Django

unread,
Oct 18, 2018, 7:43:35 PM10/18/18
to django-...@googlegroups.com
#29317: filter keyword undocumented in PostgreSQL aggregate functions
--------------------------------------+------------------------------------
Reporter: Matthew Pava | Owner: shalgrim
Type: Cleanup/optimization | Status: assigned
Component: Documentation | Version:
Severity: Normal | Resolution:
Keywords: aggregate | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------

Comment (by shalgrim):

proposed fix here https://github.com/shalgrim/django/tree/ticket_29317

--
Ticket URL: <https://code.djangoproject.com/ticket/29317#comment:6>

Django

unread,
Oct 18, 2018, 7:46:51 PM10/18/18
to django-...@googlegroups.com
#29317: filter keyword undocumented in PostgreSQL aggregate functions
--------------------------------------+------------------------------------
Reporter: Matthew Pava | Owner: shalgrim
Type: Cleanup/optimization | Status: assigned
Component: Documentation | Version:
Severity: Normal | Resolution:
Keywords: aggregate | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------

Comment (by Tom Forbes):

Hey shalgrim, can you make a pull request to the Django project with this?
If you visit https://github.com/django/django you should see a button to
do this

--
Ticket URL: <https://code.djangoproject.com/ticket/29317#comment:7>

Django

unread,
Oct 23, 2018, 7:05:02 AM10/23/18
to django-...@googlegroups.com
#29317: filter keyword undocumented in PostgreSQL aggregate functions
-------------------------------------+-------------------------------------
Reporter: Matthew Pava | Owner: Scott
Type: | Halgrim

Cleanup/optimization | Status: assigned
Component: Documentation | Version:
Severity: Normal | Resolution:
Keywords: aggregate | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Vishvajit Pathak):

I have created a PR at https://github.com/django/django/pull/10548

--
Ticket URL: <https://code.djangoproject.com/ticket/29317#comment:8>

Django

unread,
Oct 23, 2018, 9:55:33 AM10/23/18
to django-...@googlegroups.com
#29317: filter keyword undocumented in PostgreSQL aggregate functions
-------------------------------------+-------------------------------------
Reporter: Matthew Pava | Owner: Scott
Type: | Halgrim
Cleanup/optimization | Status: assigned
Component: Documentation | Version:
Severity: Normal | Resolution:
Keywords: aggregate | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Scott Halgrim):

Oh I'm sorry guys. Two things. I had meant to link to my PR before:
https://github.com/django/django/pull/10530

And I just saw Tom's comment right now.

Again, sorry for the confusion.

--
Ticket URL: <https://code.djangoproject.com/ticket/29317#comment:9>

Django

unread,
Nov 27, 2018, 4:26:49 PM11/27/18
to django-...@googlegroups.com
#29317: filter keyword undocumented in PostgreSQL aggregate functions
-------------------------------------+-------------------------------------
Reporter: Matthew Pava | Owner: Scott
Type: | Halgrim
Cleanup/optimization | Status: closed
Component: Documentation | Version:
Severity: Normal | Resolution: fixed

Keywords: aggregate | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim Graham <timograham@…>):

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


Comment:

In [changeset:"7e9d5a0aca23427d431a6628b0593c26d087658f" 7e9d5a0a]:
{{{
#!CommitTicketReference repository=""
revision="7e9d5a0aca23427d431a6628b0593c26d087658f"
[2.1.x] Fixed #29317 -- Doc'd filter argument in contrib.postgres
aggregates.

Backport of 926fa7116fd633b69277c3ad9b3370ca45163231 from master.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/29317#comment:10>

Django

unread,
Nov 27, 2018, 4:26:52 PM11/27/18
to django-...@googlegroups.com
#29317: filter keyword undocumented in PostgreSQL aggregate functions
-------------------------------------+-------------------------------------
Reporter: Matthew Pava | Owner: Scott
Type: | Halgrim
Cleanup/optimization | Status: closed
Component: Documentation | Version:
Severity: Normal | Resolution: fixed
Keywords: aggregate | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Tim Graham <timograham@…>):

In [changeset:"926fa7116fd633b69277c3ad9b3370ca45163231" 926fa71]:
{{{
#!CommitTicketReference repository=""
revision="926fa7116fd633b69277c3ad9b3370ca45163231"


Fixed #29317 -- Doc'd filter argument in contrib.postgres aggregates.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/29317#comment:11>

Reply all
Reply to author
Forward
0 new messages