PostgreSQL specific aggregation functions

PostgreSQL specific aggregation functions

New in Django 1.9.

These functions are described in more detail in the PostgreSQL docs.

Note

All functions come without default aliases, so you must explicitly provide one. For example:

>>> SomeModel.objects.aggregate(arr=ArrayAgg('somefield'))
{'arr': [0, 1, 2]}

General-purpose aggregation functions

ArrayAgg

登录查看完整内容