Re: Writing your own aggregate functions - Mailing list pgsql-novice

From Merlin Moncure
Subject Re: Writing your own aggregate functions
Date
Msg-id CAHyXU0xFi4tX70ydo5pzi6qPxsCYhziEAdS3zdSRE8O=Q_f0Bw@mail.gmail.com
Whole thread Raw
In response to Writing your own aggregate functions  (Bastiaan Olij <bastiaan@basenlily.me>)
List pgsql-novice
On Tue, Mar 5, 2013 at 9:44 PM, Bastiaan Olij <bastiaan@basenlily.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


pgsql-novice by date:

Previous
From: Bastiaan Olij
Date:
Subject: Writing your own aggregate functions
Next
From: Victor Whiskey Yankee
Date:
Subject: query on a table with an int and a vector of floating point numbers