Re: proposal: tuplestore, tuplesort aggregate functions - Mailing list pgsql-hackers

From David Fetter
Subject Re: proposal: tuplestore, tuplesort aggregate functions
Date
Msg-id 20100819215354.GA4834@fetter.org
Whole thread Raw
In response to Re: proposal: tuplestore, tuplesort aggregate functions  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: proposal: tuplestore, tuplesort aggregate functions
List pgsql-hackers
On Thu, Aug 19, 2010 at 05:40:46PM -0400, Tom Lane wrote:
> "Kevin Grittner" <Kevin.Grittner@wicourts.gov> writes:
> > Robert Haas <robertmhaas@gmail.com> wrote:
> >> I suppose there could also be a bit of an ambiguity if you're working
> >> with a type like int4 where the values are discrete steps.  Like, what
> >> do you do with {1, 2}?
> 
> Hmm, good point.
>  
> > The same thing you do with the avg function?
> 
> avg's approach is not at all datatype-independent though.  If you're
> willing to give up the idea of a polymorphic median() function, that
> would probably be the thing to do.  If not, you need to take the left
> or right one of the two central elements.

Whether the median needs to be in the sample is one question that
doesn't really have a universal right answer.  A separate question,
also without a universal right answer, is whether the median needs to
be in the same domain as the sample, int4 being the case above.

We could just go with "whatever Oracle, DB2 and MS-SQL Server have,"
assuming it's the same thing, until something appears in the SQL
standard.

Cheers,
David.
-- 
David Fetter <david@fetter.org> http://fetter.org/
Phone: +1 415 235 3778  AIM: dfetter666  Yahoo!: dfetter
Skype: davidfetter      XMPP: david.fetter@gmail.com
iCal: webcal://www.tripit.com/feed/ical/people/david74/tripit.ics

Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: proposal: tuplestore, tuplesort aggregate functions
Next
From: Robert Haas
Date:
Subject: Re: proposal: tuplestore, tuplesort aggregate functions