Stefano,
What you wrote does not look like an aggregation.
This is an aggregation: you make groups on value1,value2, and for each group you aggregate values (e.g. value3,value4).
select value1, value2, my_aggr_function(value3, value4) from table group by value1, value2
However, if that returns more than one tuple per group, it's again not an aggregation.
I have the impression that what you are looking for is: for every tuple (which might come from a previous aggregation), return a table, and concatenate the results.
This would look like:
select *
from ( (select * from my_func(x.value1, x.value2) from (select distinct value1,value2 from table) as x) );
This is possible in MonetDB. It will make a table out of each distinct (value1,value2) pair, and give you back the concatenation of all results (mind the double parentheses in the from clause, they are needed).
I have done this and works well.
Roberto