| From: | Merlin Moncure <mmoncure(at)gmail(dot)com> |
|---|---|
| To: | Bastiaan Olij <bastiaan(at)basenlily(dot)me> |
| Cc: | pgsql Novice <pgsql-novice(at)postgresql(dot)org> |
| Subject: | Re: Writing your own aggregate functions |
| Date: | 2013-03-06 03:54:39 |
| Message-ID: | CAHyXU0xFi4tX70ydo5pzi6qPxsCYhziEAdS3zdSRE8O=Q_f0Bw@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-novice |
On Tue, Mar 5, 2013 at 9:44 PM, Bastiaan Olij <bastiaan(at)basenlily(dot)me> wrote:
> Hiya,
>
> I was wondering if it is possible in Postgres to write an aggregate
> function?
>
> So say if I wanted to execute the following statement:
>
> select Column1, sum(Column2), myFunction(Column3)
> from MyTable
> group by Column1
>
> Could I implement myFunction as a stored function and how would I go
> about doing so?
it's trivial (and an extremely underutlized feature):
http://www.postgresql.org/docs/9.2/static/xaggr.html
merlin
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Victor Whiskey Yankee | 2013-03-07 01:49:49 | query on a table with an int and a vector of floating point numbers |
| Previous Message | Bastiaan Olij | 2013-03-06 03:44:39 | Writing your own aggregate functions |