You can implement user defined aggregate functions by implementing org.h2.api.AggregateFunction
I have been using it and it works fine.
See: http://h2database.com/javadoc/index.html

- rami

On 1.4.2015 14:24, Fred&Dani&Pandora&Aquiles wrote:
Hi Noel,

The string_agg is aggregate function similar to group_concat. The user defined functions can be applied in this case?

As I wasn't sure about this, I started to work in a simple patch to support the string_agg in Postgres style. To keep simplicity, I just added the possibility of comma as delimiter and the string_agg aggregate with the group_concat type. However, I noted that is possible to mix the syntaxes of H2 and Postgres which could lead to some errors like: select string_agg(cola order by colb,colc,'/'). In the previous example, the default comma delimiter will be used because the delimiter '/' will be treated as a 'column' during agg.setGroupConcatOrder(parseSimpleOrderList()). In cases where the string_agg be wrote as expected in Postgres, the aggregation will work.

Finally, If you considerer beneficial the inclusion of the new aggregate function, do you think would be valid to ensure the correct syntaxe of Postgres aggregate?

Regards,

Fred

2015-04-01 4:28 GMT-03:00 Noel Grandin <[email protected] <mailto:[email protected]>>:



    On 2015-03-31 03:15 PM, Laurent Wang Stemmer wrote:


        Do you have any idea how I can mimic this aggregate function
        string_agg with H2 without making my test irrelevant ?


    http://h2database.com/html/features.html#user_defined_functions


-- You received this message because you are subscribed to the Google
    Groups "H2 Database" group.
    To unsubscribe from this group and stop receiving emails from it,
    send an email to [email protected]
    <mailto:h2-database%[email protected]>.
    To post to this group, send email to [email protected]
    <mailto:[email protected]>.
    Visit this group at http://groups.google.com/group/h2-database.
    For more options, visit https://groups.google.com/d/optout.


--
You received this message because you are subscribed to the Google Groups "H2 Database" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected] <mailto:[email protected]>. To post to this group, send email to [email protected] <mailto:[email protected]>.
Visit this group at http://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.

Reply via email to