Opened 15 years ago

Closed 15 years ago

Last modified 11 years ago

#10924 closed (wontfix)

Should use variance() and stddev() rather than var_samp() and stddev_samp() on Postgresql < 8.2

Reported by: Richard Davies <richard.davies@…> Owned by:
Component: Database layer (models, ORM) Version: dev
Severity: Keywords:
Cc: richard.davies@… Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

As per http://developer.postgresql.org/pgdocs/postgres/release-8-2.html , the aggregation functions var_pop(), var_samp(), stddev_pop(), and stddev_samp() were first introduced in Postgresql 8.2.

However, var_samp() and stddev_samp() were merely renamings of the pre-existing aggregates variance() and stddev(), so we could extend support to earlier versions of Postgresql by using those older function names where appropriate.

Change History (2)

comment:1 by Russell Keith-Magee, 15 years ago

Resolution: wontfix
Status: newclosed

This works for Postgres, but unfortunately it poses problems cross-platform. MySQL uses StdDev and Variance as aliases for the population statistics, not the sample statistics. I believe the unofficial SQlite extension that supports stddev and variance does the same.

We could make the determination of the backend function a very complex affair in order to support every possible database, but in the interests of keeping implementations simple, I'm going to mark this wontfix. For those users using Postgres pre 8.2, defining a custom aggregate function isn't that difficult - in this case, it's just a matter of subclassing the Django provided aggregates and overriding the function name.

comment:2 by Anssi Kääriäinen, 11 years ago

Component: ORM aggregationDatabase layer (models, ORM)
Note: See TracTickets for help on using tickets.
Back to Top