Skip site navigation (1) Skip section navigation (2)

Re: wip: functions median and percentile

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com>, Hitoshi Harada <umi(dot)tanuki(at)gmail(dot)com>, Greg Stark <gsstark(at)mit(dot)edu>, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, David Fetter <david(at)fetter(dot)org>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: wip: functions median and percentile
Date: 2010-10-11 10:33:12
Message-ID: AANLkTinkJkO1bObCsBr3yu_+ODBbJdh_CxXTzGddVH=n@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-hackerspgsql-rrreviewers
On Sun, Oct 10, 2010 at 5:16 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> It was pointed out upthread that while median isn't presently
> in the standard, Oracle defines it in terms of percentile_cont(0.5)
> which *is* in the standard.  What I read in SQL:2008 is that
> percentile_cont is defined for all numeric types (returning
> approximate numeric with implementation-defined precision),
> and for interval (returning interval), and not for any other
> input type.  So it appears to me that what we ought to support
> is
>        median(float8) returns float8
>        median(interval) returns interval
> and nothing else --- we can rely on implicit casting to convert
> any other numeric input type to float8.

Isn't there a possibility of a precision loss if numeric gets cast to
float8?  Should we include an explicit variant from numeric?

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Responses

pgsql-hackers by date

Next:From: Vaibhav KaushalDate: 2010-10-11 10:44:04
Subject: Re: Which file does the SELECT?
Previous:From: Dean RasheedDate: 2010-10-11 10:33:11
Subject: Re: wip: functions median and percentile

pgsql-rrreviewers by date

Next:From: Tom LaneDate: 2010-10-11 14:03:40
Subject: Re: wip: functions median and percentile
Previous:From: Dean RasheedDate: 2010-10-11 10:33:11
Subject: Re: wip: functions median and percentile

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group