Seems dangerous as heck; certainly it would have side-effects far more wide-ranging than just making this particular function work.
A safer answer is to split array_agg into two functions, array_agg(anynonarray) -> anyarray array_agg(anyarray) -> anyarray
I rather imagine you should do that anyway, because I really doubt that this hack is operating quite as intended. I suspect you are producing arrays containing arrays as elements, not true 2-D arrays. That's not a direction we want to go in I think; certainly there are no other operations that produce such things.
Thanks for the review. Yes, it looks like the patch produced array as the elements. So, all array operations behaves wierdly.
In this quick & dirty patch, I am trying to implement the array_agg(anyarray), introducing two new functions:
At first, i want to use accumArrayResult and makeMdArrayResult, but it's complicated to work with multi-dimensional arrays with those two functions. So i combined array_cat with those function.