Adding missing aggregate functions to contrib.postgres ?

184 views
Skip to first unread message

Andriy Sokolovskiy (coldmind)

unread,
Feb 7, 2015, 9:00:14 AM2/7/15
to django-d...@googlegroups.com
So, since django has contrib.postgres, maybe it would be reasonable to add postgres-specific aggregate functions to this module?
If it is good idea, I'm gonna create ticket and implement this.

Michael Manfre

unread,
Feb 7, 2015, 11:51:34 AM2/7/15
to django-d...@googlegroups.com
It's reasonable to support backend specific aggregate functions. The database backend API contains BaseDatabaseOperations.check_expression_support for this exact reason. Feel free to create the ticket.

Regards,
Michael Manfre

On Sat, Feb 7, 2015 at 9:00 AM, Andriy Sokolovskiy (coldmind) <soka...@yandex.ru> wrote:
So, since django has contrib.postgres, maybe it would be reasonable to add postgres-specific aggregate functions to this module?
If it is good idea, I'm gonna create ticket and implement this.

--
You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-develop...@googlegroups.com.
To post to this group, send email to django-d...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-developers.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/2d3b2bd2-3bce-4e40-8383-ef5ca328bc26%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Andriy Sokolovskiy (coldmind)

unread,
Feb 7, 2015, 6:11:08 PM2/7/15
to django-d...@googlegroups.com
I opened a ticket for it.
https://code.djangoproject.com/ticket/24301

суббота, 7 февраля 2015 г., 18:51:34 UTC+2 пользователь Michael Manfre написал:

Andriy Sokolovskiy (coldmind)

unread,
Feb 7, 2015, 8:27:20 PM2/7/15
to django-d...@googlegroups.com
OK, since ticket was market as accepted, should *all* aggregates functions from http://www.postgresql.org/docs/9.4/static/functions-aggregate.html be implemented ? I'm asking to prevent doing unnecessary work. 

воскресенье, 8 февраля 2015 г., 1:11:08 UTC+2 пользователь Andriy Sokolovskiy (coldmind) написал:

Russell Keith-Magee

unread,
Feb 8, 2015, 7:01:25 PM2/8/15
to Django Developers

Hi Andriy,

If we're going down this path, I can't think of any reason we wouldn't target ever available aggregate. It doesn't need to be all in one patch/PR - in fact, I'd suggest that unless the implementations are particularly intertwined, one patch per aggregate (or aggregate group - e.g., all the bit_* aggregates) would be preferable.

The only other thing I'd flag is that if any of these aggregates are recent additions (e.g., added in Postgres 9), the failure mode for earlier versions should be relatively clean. 

Yours,
Russ Magee %-)

Andriy Sokolovskiy (coldmind)

unread,
Feb 9, 2015, 9:07:37 AM2/9/15
to django-d...@googlegroups.com
I implemented some of functions:
https://github.com/coldmind/django/compare/postresql_aggregate_functions

Implementation of general-purpose functions is trivial; statistic-purpose functions are somewhat different.

I want include to the first pull request general-purpose and statistic-purpose functions.
The others (ordered- and hypotetical-set) are more complex and must go to other pull request.

Early feedback will be appreciated (in fact, the main thing I want to know is am I going in the right direction or not.)

понедельник, 9 февраля 2015 г., 2:01:25 UTC+2 пользователь Russell Keith-Magee написал:

Josh Smeaton

unread,
Feb 9, 2015, 3:25:50 PM2/9/15
to django-d...@googlegroups.com
Hi Andriy,

The direction looks OK to me, but it'll be a lot easier to review properly once you've opened a pull request.

I'm not sure that you need to separate out "general" and "statistics" into different modules, but that's something we can discuss on the PR.

Nice work :)

Josh

Andriy Sokolovskiy (coldmind)

unread,
Feb 10, 2015, 11:31:55 AM2/10/15
to django-d...@googlegroups.com
Pull request is here.
https://github.com/django/django/pull/4105

понедельник, 9 февраля 2015 г., 22:25:50 UTC+2 пользователь Josh Smeaton написал:

Shai Berger

unread,
Feb 10, 2015, 5:46:16 PM2/10/15
to django-d...@googlegroups.com
On Monday 09 February 2015 02:01:03 Russell Keith-Magee wrote:
>
> The only other thing I'd flag is that if any of these aggregates are recent
> additions (e.g., added in Postgres 9), the failure mode for earlier
> versions should be relatively clean.
>
Nitpick: Django 1.8 -- the first to have django.contrib.postgres -- supports
Postgres 9.0 and up.

Shai.
Reply all
Reply to author
Forward
0 new messages