obs-browser icon indicating copy to clipboard operation
obs-browser copied to clipboard

Custom aggregate support

Open sachaarbonel opened this issue 7 years ago • 3 comments

Hi @microo8 I was searching how to apply my functions on an entire column and not on an array I found useful articles about custom aggregations:

Do you think it could be tricky to create a type Aggregate and automate the rewrite of the functions in the sql file ?

sachaarbonel avatar Aug 22 '18 18:08 sachaarbonel

I can take a look at custom aggregates and figure out what to do.

But for now you can do something like this:

select myfunction(array_agg(column)) from table

microo8 avatar Aug 23 '18 06:08 microo8

Ok thank's a lot I thought it could improve on performances to use aggregations

sachaarbonel avatar Aug 23 '18 10:08 sachaarbonel

This may already be possible by writing normal functions in go and exposing them using plgo to postgres. Then use "create aggregate.." and compose in those functions.

"A simple aggregate function is made from one or two ordinary functions: a state transition function sfunc, and an optional final calculation function ffunc"

  • https://www.postgresql.org/docs/9.5/sql-createaggregate.html

onshorechet avatar Apr 11 '19 02:04 onshorechet