Re: MEDIAN as custom aggregate? - Mailing list pgsql-sql

From Josh Berkus
Subject Re: MEDIAN as custom aggregate?
Date
Msg-id web-148453@davinci.ethosmedia.com
Whole thread Raw
In response to Re: MEDIAN as custom aggregate?  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-sql
Tom,

> Um ... does that work?  I thought LIMIT was fairly restrictive about
> what it would take as a parameter --- like, constants or $n
> parameters
> only.
> 
> I do not know of any median-finding algorithm that doesn't require a
> depressingly large amount of storage...

Me neither.  You're right; the query didn't work.  

Here's a link to the median-finding function I posted to the CookBook:

http://www.brasileiro.net/postgres/cookbook/view-one-recipe.adp?recipe_id=1654

Anyone who can improve it is welcome!

-Josh

______AGLIO DATABASE SOLUTIONS___________________________                                      Josh Berkus Complete
informationtechnology      josh@agliodbs.com  and data management solutions       (415) 565-7293 for law firms, small
businesses       fax 621-2533   and non-profit organizations.      San Francisco
 


pgsql-sql by date:

Previous
From: Vivek Khera
Date:
Subject: Re: VARCHAR vs TEXT
Next
From: "Ross J. Reedstrom"
Date:
Subject: Re: to_char()??