#10924 closed (wontfix)
Should use variance() and stddev() rather than var_samp() and stddev_samp() on Postgresql < 8.2
Reported by: | 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 , 16 years ago
Resolution: | → wontfix |
---|---|
Status: | new → closed |
comment:2 by , 12 years ago
Component: | ORM aggregation → Database layer (models, ORM) |
---|
Note:
See TracTickets
for help on using tickets.
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.