Custom aggregate support
sachaarbonel opened this issue · 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:
- custom aggregates in postgresql
- writing your own aggregation functions
- create multi column aggregates
Do you think it could be tricky to create a type Aggregate and automate the rewrite of the functions in the sql file ?
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
Ok thank's a lot I thought it could improve on performances to use aggregations
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"